I'm trying to upload image as file but I'm not sure how to do it exactly.
Here is my input:
<input type="file" name="image" placeholder='Image' onChange={e => handleSetImage(e, i)}/>
Here is the error for "e":
Argument of type 'ChangeEvent' is not assignable to parameter of type 'FileList'. Type 'ChangeEvent' is missing the following properties from type 'FileList': length, item, [Symbol.iterator]ts(2345)
And here is my handler:
const [colorsAndImages, setColorsAndImages] = useState<[{image: object, color: string}]>([{image: {}, color: ''}])
...
const handleSetImage = (event: FileList, index: number) => {
const files = event;
const list = [...colorsAndImages]
list[index][image] = list
console.log(list);
};