Skip to content

Why setErrors() doesn't trigger child memo component render? #10621

Answered by leapful
Cow258 asked this question in Q&A
Discussion options

You must be logged in to vote

@Cow258

Object errors will not change its reference via setErrors() method as it's a root error object and will be accessed via formState proxy.

If you want to get errors from memorized component, just use useFormState instead.

Working demo: https://codesandbox.io/s/react-hook-form-forked-qz6rkg?file=/src/App.js

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Cow258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants