Watch() on an array not updating when calling setValue
See original GitHub issueDescribe the question? Not sure if this is a bug.
Custom input registered and the value is being watched.
When calling setValue()
with an array of objects the watched value is not updated.
To Reproduce
- Go to https://codesandbox.io/s/react-hook-form-useform-template-5lynl?file=/src/custom-field.js
- Try the form out by entering a value and pressing the button
- This will push an item onto an array and call
setValue
- Expecting the watched value to update and re-render the component
Codesandbox link (Required) https://codesandbox.io/s/react-hook-form-useform-template-5lynl?file=/src/custom-field.js
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The useState set method is not reflecting a change immediately
Component or React.PureComponent , the state update using the updater provided by useState hook is also asynchronous, and will not be reflected immediately....
Read more >Setvalue is not updating properly in onchange for - ServiceNow
Solved: Hi, I am writing a script to populate the values from list collector to Multi line text field using catalog client script...
Read more >Reactivity API: Core - Vue.js
watch() is lazy by default - i.e. the callback is only called when the watched source has changed. The first argument is the...
Read more >useHooks - Easy to understand React Hook recipes
We bring you easy to understand React Hook code recipes so you can learn how React hooks work and feel more comfortable writing...
Read more >4 Examples of the useState Hook - Dave Ceddia
First, we're creating a new piece of state by calling useState , initializing it to 0. It returns an array containing that initial...
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
🤦🏽♂️I will get back to you. I recreated the CSB and now the issue is not happening
no worries 👍 feel free to re-open if you find the way to reproduce.