[英]What is type for file upload Event in react typescript?
我想在代碼中添加類型,但我不知道我可以使用什么類型
const handleFileChange = (e: any>) => {
setCollect({
...collect,
[e.target.name]: e.target.files[0],
});
};
不會用,怎么修
此事件的正確鍵入如下:
React.ChangeEvent<HTMLInputElement>
它會讓你訪問e.target.files
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.