-
Hello, I am struggling to re-render when I am using I have created the below sandbox to showcase the issue: https://codesandbox.io/s/react-hook-form-v7-form-context-forked-ojp8ee?file=/src/Test.js In I am confused what I am missing. I did add Any help appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
if you want to subscribe to value update, you can use watch/useWatch. |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
I am facing issue where if I use
to watch all of form data, then when form data changes, this component having the useWatch is not re-rendering. |
Beta Was this translation helpful? Give feedback.
@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