Getting errors in form api hooks
See original GitHub issueI’m getting this error every time i try to use a function in formApi hooks
Uncaught TypeError: formApi.setValue is not a function
Here is what i’m getting by consoling logging it:
Here is my code:
I’m using version 2.3.0 but i already tried to upgrade it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React Hook Form - Display custom error message returned ...
This is a quick example of how to display a custom error message on a React Hook Form that is returned from an...
Read more >useForm - setError - React Hook Form
An error that is not associated with an input field will be persisted until cleared with clearErrors . shouldFocus doesn't work when an...
Read more >react-hook-form handling server-side errors in handleSubmit
I'm having a hard time figuring out how to handle errors that don't necessarily pertain to a single input field in a react-hook-form...
Read more >How to handle a failed API request that is not specific to a field?
If the API request to submit the form data fails with an error that is not specific to a single form field ......
Read more >React Hook Form Validation with Complete Examples | refine
React Hook Form uses its constraint-based validation API to validate ... the specified amount in the maxLength props, we'll get an error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
^^^^ @victorbf yes you cant use hooks outside of the
<Form />
You can try this insteand of useFormApi:
<Form> { ({ formState, formApi }) => ( <> <Field field="fieldName"/> <button onClick={ev => { formApi .setValue('fieldName', 'test'); // or // formApi .setValues({ 'fieldName': 'test' }); }} > click button </button> </> ) }