You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using useFieldArray in React Hook Form to manage multiple forms. Each form in the array has its own submit button. My challenge is that upon submitting any one of these forms, the onSubmit function provides the data for the entire array of forms. However, I want to only get the data from the form that was actually submitted. How can I isolate the submission and data retrieval to only the form that was submitted, ignoring the rest in the array?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using useFieldArray in React Hook Form to manage multiple forms. Each form in the array has its own submit button. My challenge is that upon submitting any one of these forms, the onSubmit function provides the data for the entire array of forms. However, I want to only get the data from the form that was actually submitted. How can I isolate the submission and data retrieval to only the form that was submitted, ignoring the rest in the array?
Here is example how it works now. So instead of onSubmit getting whole array i want that it gets only the submitted form. Could i use some filtering to get the submitted form data from the array.
https://stackblitz.com/edit/stackblitz-starters-a9dlzp?file=app%2FWorkExperienceDetail.tsx
Beta Was this translation helpful? Give feedback.
All reactions