useFormContext is triggering updates in useEffect
See original GitHub issueDescribe the bug
When using methods coming from useFormContext with useEffect, it is causing updates.
To Reproduce Console will log hit on each update https://codesandbox.io/embed/react-hook-form-form-context-ki90u
Expected behavior Should not trigger a re-render
I believe that it is just the accumulation of the props causing a new value each time.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
useForm - watch - Simple React forms validation
This API will trigger re-render at the root of your app or form, ... useEffect 's deps, to detect value update you may...
Read more >useForm | React Hook Form - Simple React forms validation
Name, Type, Description. onSubmit, string, Validation will trigger on the submit event and inputs will attach onChange event listeners to re-validate them.
Read more >useForm - setValue - React Hook Form
When an error is triggered or corrected by a value update. When setValue cause state update, such as dirty and touched. It's recommended...
Read more >useForm - trigger - Simple React forms validation
Triggers validation on multiple fields by name. trigger(["yourDetails.lastName"]). shouldFocus, boolean. Should focus the input during setting an error.
Read more >useWatch | React Hook Form - Simple React forms validation
useWatch 's result is optimised for render phase instead of useEffect 's deps, to detect value updates you may want to use an...
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

@bluebill1049 Sorry, I didn’t have a chance to look at this over the weekend. I’m unsure about using the hook
useMemoin that way. If it works, we can keep it until we can come up with a better way to resolve it.Should have been fixed in the latest patch