Hi Mitch! I’d typically avoid using refs for this sort of thing. Pass the data for each row in as an array to your table component, and work on that data set instead.
Thanks! That seems to be the way to go so I did. And in the process, made individual components for Cells, and Rows. It allowed to further generalize and use the table in with other components.
Hi Mitch! I’d typically avoid using refs for this sort of thing. Pass the data for each row in as an array to your table component, and work on that data set instead.
Your API could look like this:
The Table component would then loop through the data and create the rows you need.
The
addRowandremoveRowfunctions would then change thedatastate variable.Thanks! That seems to be the way to go so I did. And in the process, made individual components for Cells, and Rows. It allowed to further generalize and use the table in with other components.
Yay!