react-hook-form: setValue on useFieldArray not updating whole object
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!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (9 by maintainers)
?
No worries @themre feel free to follow up with questions. You can send questions at Spectrum as well. 👍
Yes, makes sense. It’s a mind shift from usual React way 😃 Thanks for all the help, you sure made a lot of things more clear! I will close this since there are no bugs and just my misunderstanding.