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.

useWatch value become empty after delete field array item

See original GitHub issue

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/react-hook-form-v6-usewatch-mjnow?file=/src/index.js
  2. Click on append
  3. Click on append
  4. Click on delete
  5. See JSON output

Expected behavior A clear and concise description of what you expected to happen.

it should preserve value same as watch

Screenshots If applicable, add screenshots to help explain your problem. image image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bluebill1049commented, Jul 21, 2020

you will have to do watch('xxx', fields) i am going to add a FAQ section for this.

0reactions
bluebill1049commented, Jul 25, 2020

oh wait, sorry i miss look the issue with watch API, i will take a look at it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

useFieldArray - Simple React forms validation
When you append, prepend, insert and update the field array, the obj can't be empty object rather need to supply all your input's...
Read more >
UsefieldArray react hook form deleting the last element only
Basically I'm trying to append and delete but the problem is when I'm deleting its deleting only the last element. append is working...
Read more >
react hook form nested | The AI Search Engine You Control
The problem is when i remove a field from the array. The Handler component re-renders having correct values on the fields data. But...
Read more >
Set a watch on variables - Visual Studio (Windows)
While you're debugging, you can use Watch windows and QuickWatch to watch variables and expressions. The windows are only available during a ...
Read more >
Vue 3 Composition API - watch and watchEffect - This Dot Labs
This function will be automatically called whenever the value of notes changes (for example, when text is entered into the field). Each watcher ......
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