I have a global table component with react table checkboxes (child component). I want to use it on a page (parent component) and save the selectedFlatRows in the parent state.
this is how I update the state from my table component
useEffect(() => {
if(selectedFlatRows && selectedFlatRows.length) onSelectChange(selectedFlatRows.map(row => row.original))
}, [selectedFlatRows]);
But when a parent state changes, the table rerenders too. And it's going to reset the selection.
Is there a way to use the checkbox table from the child component and save it to the parent state without reset? I have tried react memo but it's not working