Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: React File Input Reset

Dan The Goodman pro asked 5 years ago


Does anyone know of any way to reset the file input?


Roman Mzh priority answered 5 years ago


quick solution:

move filechange to useState hook with dependency on props:

+ useEffect(() => { fileChange(props.value) }, [props.value]);

- fileChange(e.target.files); in onChangeHandler function


Piotr Glejzer staff commented 5 years ago

Thanks for this fix. Thank you very much. Have a nice day.


Roman Mzh priority answered 5 years ago


bump.

case: reset value after uploading file.

passing empty array to value prop does not help.


Aliaksandr Andrasiuk staff answered 5 years ago


Hello,

There is no such functionality for now. We will add it in the near future.

Best regards,

Aliaksandr from MDB.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.10.0
  • Device: Any
  • Browser: Electron
  • OS: Any
  • Provided sample code: No
  • Provided link: No
Tags