-4
I’m studying Reactjs and Typescript, and also a lib for forms called Unform (https://github.com/Rocketseat/unform).
I have a form with some fields, among them a Select field (https://react-select.com/). My problem is: How to clear this React-select field after submitting the form?
Repository of my project: https://github.com/fredarend/icetec-frontend
The form is in: src/pages/Dashboard/indext.tsx and the Select component is in src/Components/Select/index.tsx.
Note that in the Dashboard index I’ve used the formRef.current?.reset()
after sending the data to the API, however, it is resetting only the inputs, Select does not continue with filled.
I’m not getting to implement anything that works, someone might have done it already?
From now on, thank you very much for your help!
value={selectedOption}
in that part of the code you arrowselectedOption = null
usually with component status variable.– novic