formState.isValid is not being updated when fields are registered in useEffect
See original GitHub issueDescribe the bug
The formState.isValid property doesn’t update when using useEffect to register the fields.
To Reproduce The codesandbox below shows the behaviour. https://codesandbox.io/embed/bug-react-hook-form-formstateisvalid-wont-change-if-fields-are-registered-on-useeffect-segvo
Expected behavior The formState.isValid should change accordingly.
Additional context I just started using this library, so I hopefully I didn’t miss anything. But I am trying for more than 1 hour and I can’t find any issues with the example code. It suppose to work according to the docs.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
reactjs - 'isValid' is always false
I am using custom register in react-hook-form , and I am unable to get formState.isValid to be true when I enter text into...
Read more >Bug (react-hook-form): formState.isValid won't change if ...
Bug (react-hook-form): formState.isValid won't change if fields are registered on useEffect by lnmunhoz using react, react-dom, react-hook-form, ...
Read more >useForm - FormState
Set to true if the form doesn't have any errors. setError has no effect on isValid formState, isValid will always derived via the...
Read more >react hook form onblur not working
So when all of your fields become valid, it does not trigger validation. ... will have to register during useEffect , and update...
Read more >API Documentation
Note: defaultValues doesn't auto populate with the manually registered input (eg: register({ name: 'test' }) ) because the manual register field does not...
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
Oh all right! I didn’t see that. Makes sense.
In my opinion this validate should be
trueby default, being false is so counterintuitive. I will give it a try. Thank you!However it need to be default to false. Because you aren’t certain it’s valid just yet