I have a problem with use reset to clean my form.
When I use that function, my form that have two selects wrapped by Controller, even that I define default value with only one, both did clean.
Can I have way to prevent this?
Example of code:
reset({
state: ''
});
return (
<>
<Controller
name='country'
render={({ field }) => <Select {...field} />}
/>
<Controller
name='state'
render={({ field }) => <Select {...field} />}
/>
</>
);
After reset state is ” and country is undefined.
I tried to use reset by passing only one property, but it still didn’t work.
The expected result is that it clears only the ‘state’ Select.
Lucas Eduardo Gomes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.