Help needed ðŸ˜: Editable Cells, total calculations, react-hook-form to handle data state
react-virtual table + react-hook-form (useFieldArray)
Link: https://codesandbox.io/p/devbox/vigilant-proskuriakova-w6hspc
Total
I'd like to ask for help: How to calculate the "total" values for rows with the same "category" if the cells are editable? (category is set in data for every item). I tried to use aggregateFn, but couldn't manage it.
Probably using the useWatch on every "onChange" event to calculate the total is not efficient.
Data State
The initial data structure has to be mutated and send back to the backend. For this reason I thought to use a "React Hook Form" lib and modify the data with Controllers.
But I couldn't find the way without transforming the data for table structure purpose. And probably useFieldArray has to be used somehow (this will allow to append new rows), but fields are also not updating.
P.s. virtual is use, cuz it might be >600 rows and >=10-15 columns
I'll really appreciate your help
0 Replies