Is there a simple way to get only the altered form field values? #1528
Replies: 2 comments
-
It's not provided by the library as of v1.11.3, I'm afraid. Meta properties like If that's all you need, then you can iterate over However, obtaining the diffs between two objects in JavaScript is a big topic, and you have both access to the current values |
Beta Was this translation helpful? Give feedback.
-
Thanks for the informed response @LeCarbonator. This is an extremely common functionality that many people would need. Perhaps it should be in the project roadmap if it isn't already? For now, since "dirtyFields" are provided out of the box by react-hook-form, implementing the same thing from scratch here adds needless complexity and prevents me from switching to Tanstack Form. I appreciate the work that the team is doing on this project and understand that it is early days still so things like this may not be covered yet |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In react-hook-form, one can use formState.dirtyFields to obtain all of the form fields that have been changed. Ideally I wouldn't be sending the entire form state to my backend when only one field has been changed. But it feels complicated to figure this out upon form submission. What is the recommended way to do this?
Beta Was this translation helpful? Give feedback.
All reactions