issue: changing name of useWatch doesn't change anything
See original GitHub issueVersion Number
7.33.1
Codesandbox/Expo snack
https://codesandbox.io/s/sparkling-snow-z06xpt?file=/src/App.js
Steps to reproduce
- create component with useWatch
- change name of fields which watch are needed
Expected behaviour
react-hook-form resubscribe for new fields when name parameter in useWatch
hook was changed.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
useWatch value not updated after reset #3205 - GitHub
However when I update to the latest react-hook-form, 6.9.4 It does not work as expected. The useWatch value is not updated!
Read more >useWatch | React Hook Form - Simple React forms validation
useWatch 's execution order matters, which means if you update a form value before the subscription is in place, then the value updated...
Read more >React Hook Form useWatch not displaying correct value in ...
For anyone that may have this issue, I was able to fix it by using setValues to initially set the value on render...
Read more >React Hook Form - useForm: watch - YouTube
If playback doesn't begin shortly, try restarting your device. Your browser can't play this video. ... UseWatch. UseWatch. 7:04 ...
Read more >Form - Ant Design
Name (Watch to trigger rerender). Age (Not Watch). Name Value: Watch Hooks. useWatch helps watch the field change and only re-render for the...
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
Expected behavior. The
name
value is used to subscribe to a specific input; it’s not dynamic.You should have multiple subscriptions instead. For optimization purposes you can make use of the
disabled
prop to toggle the subscription depending on your use-case conditionThank you for your solution. I guess
watch() callback
is gonna work for a while. BTW, many thanks for this library! You’ve done great work.