I am creating a dynamic table in React which update fields based on user inputs in other fields. There is a React object which contains information on all the fields. I would like to use information on certain fields to update other fields. I was thinking of doing the following:
- Create a data structure with the initial values for the table
- Convert the data structure into a React object which would be rendered
- When the user types in an editable field, that changes the React object. That would then be used to update the data structure.
- Computations would be done with the data structure to get table values. The data structure would be updated with the new table values
- The data structure would be used to update the React object.
I don’t know if this just make sit unnecessarily complicated or if this is a good approach. (The alternative I think would be to do computations by getting values from and updating the React objects directly).