setValue on useFieldArray not updating whole object

See original GitHub issue

Hi, First I’m very grateful for such a wonderful library and how much effort you put in resolving all the issues! I tried to find a solution and not bother you but in the end I had to post an issue/question. I was working on this demo: https://codesandbox.io/s/react-hook-form-usefieldarray-n993y?file=/src/index.js

Here I used clear button to clear certain field in array. However I bumped into issues First thing: If you click clear button it will clear input field. However if you click some other field, it will reset previously cleared input field. Do I need to watch all items and then used this to clear them? Second: I have a large object which I want to set value. But I don’t use all fields and thus they won’t appear in my callback submit. How can I merge everything with my full object and always have updated object? I don’t want to use some sort of merge util function from lodash or something else.

Thanks!

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
bluebill1049commented, Apr 29, 2020
reset({
  ...
})

?

1reaction
bluebill1049commented, Apr 29, 2020

No worries @themre feel free to follow up with questions. You can send questions at Spectrum as well. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

useForm - setValue - React Hook Form
To update the entire Field Array, make sure the useFieldArray hook is being executed first.
Read more >
How to set array in useForm and validate the length of value?
I'm using react-hook-form. What I wanna do is to push a value to an array and validate the length of value. This is...
Read more >
Creating recursive and dynamic forms with React Hook Form ...
The useFieldArray hook returns various useful objects and functions that allow us to interact with the array. In this application, we use the ......
Read more >
React Hook Form - useFieldArray setValue - CodeSandbox
A custom hook for working with Field Arrays (dynamic inputs). 0. 15.6k.
Read more >
React Hook Form - useForm: setValue - YouTube
This session cover setValue API inside react hook form.Doc: https://react-hook-form.com/api/useform/ setValue.
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