Skip to content

How to cause re-render on setValue in FormContext #9054

Answered by leapful
Nav-2d asked this question in Q&A
Discussion options

You must be logged in to vote

@Nav-2d : API "setValue" will try to avoid re-rendering by only updating real DOM input element. If you want to watch on change of input value, you can use "watch" on the field name to trigger re-rendering.

Working demo: https://codesandbox.io/s/react-hook-form-v7-form-context-forked-1tl18z?file=/src/Test.js

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bluebill1049
Comment options

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