DZuz14 / react-use-file-upload

A React Hook to make file uploading easier.
MIT License
18 stars 10 forks source link

Improve typing for events and make files reactive when the same file is chosen again #11

Open nainglinnkhant opened 1 year ago

nainglinnkhant commented 1 year ago

Currently, events from the input handler needs to be cast as Event to pass into setFiles. The new changes in types solve this.

Another thing is input's onChange doesn't get triggered if the same file is chosen again. Cleaned the old files so that it gets triggered every time whether the files are the same or not. I suggest clearing files for the dataTransfer either by e.dataTransfer.clearData().