What is type for file upload Event in react typescript?

Viewed 20

I want to add type in code but I don't know about what type can I use

const handleFileChange = (e: any>) => {
setCollect({
  ...collect,
  [e.target.name]: e.target.files[0],
 });
};

I won't use any, how can I fix it

1 Answers

Proper typing for this event is the following:

React.ChangeEvent<HTMLInputElement>

It will let you access e.target.files.

Related