question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Watch() on an array not updating when calling setValue

See original GitHub issue

Describe 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

  1. Go to https://codesandbox.io/s/react-hook-form-useform-template-5lynl?file=/src/custom-field.js
  2. Try the form out by entering a value and pressing the button
  3. This will push an item onto an array and call setValue
  4. 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
raulfelixcommented, May 5, 2020

🤦🏽‍♂️I will get back to you. I recreated the CSB and now the issue is not happening

0reactions
bluebill1049commented, May 6, 2020

no worries 👍 feel free to re-open if you find the way to reproduce.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found