Watch not re-rendering when input value property changes
See original GitHub issueDescribe the bug
Assigning value
directly to an input is not triggering watch
re-render when value
changes.
To Reproduce https://codesandbox.io/s/react-hook-form-watch-v6-forked-ydwdn?file=/src/index.js
Enter a value in the first field. The second field is correctly updated but in the console, the value returned by watch("name2")
is outdated. (no re-render were triggered)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Problem of re-rendering useEffect with watch all fields using ...
You are using react-hook-form watch method. this method will re-render at the root level of the app whenever a field value is changed....
Read more >Changing @input value not rerendering the component. - Reddit
Hi, I am having this issue that changing the value of @input variable in the parent is no reinitializing the component again.
Read more >How and when to force a React component to re-render
The component did not change, so there was no re-rendering trigger. Here's why. React evaluates state changes by checking its shallow equality ( ......
Read more >Reactivity for Fields, Objects, and Arrays
If a field's value changes, and the field is used in a template or in a getter of a property that's used in...
Read more >Lifting State Up - React
In React, this is usually solved by making a component “controlled”. Just like the DOM <input> accepts both a value and an onChange...
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
@cwagner22 Works now! May I ask what’s the use case for this? I’m not sure if it’s really a bug as you’d be getting double render on every key stroke
Hi @cwagner22, your CodeSandbox link seems to be a broken build (referencing undefined value
test
)