I am working on a data form which has a custom component made up of three input fields. The component looks like this :
I can also append more rows of the same component:
I want the main form to always have a copy of the component input data so it can be attached to an REST API request.
Now my question is where should I keep my single source of truth? Inside the individual rows themselves or shall I keep it in the form like so :
Thanks in advance.
You already answered your question yourself: “I want the main form to have the component input data“
Also, the parent form needs to keep (and modify) the state to be able to add and remove rows.