-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use react-hook-form's setValue etc #80
Comments
@yyykkkyyy There is one solution to it using iife
Similarly you can use other function which are available in useForm() hook |
There is one more solution, but it is pretty big one. First you have to change the Form.tsx component to this
Then create a hook named useHookForm.ts
Then in Login.tsx you can do like this
@alan2207 If you like this solution, I can change it in the whole app, and then I can raise a pr for it ? |
Hi ! I'm learning from this wonderful repository.
I would like to ask that can I use react-hook-form's setValue etc.
In this repo's Form structure, how to use setValue etc from other components.
I think that this repo's form structure offers really reusable error handling and labeling.
On the other hand, I don't find appropriate way to set values dynamically on this form structure.
I envision a form that automatically populates the next form with values based on the input values.
For instance, I tried the code like below:
And below is my sample input field.
I use MUI for input components, so I use a
control
variable and it is used forController
in the component.I can get
setValue
,watch
and something, but I don't understand how to use these variables.I understand this is very general and not critical question.
I would really appreciate it if you could answer my question.
Thanks.
The text was updated successfully, but these errors were encountered: