T
TanStack17mo ago
fair-rose

RowSelectionState change is not persisted after row selection

When I select a row, the selection state seems to be refreshed, anyone have encoutered a similar issue ?
No description
No description
4 Replies
foreign-sapphire
foreign-sapphire17mo ago
The useEffect is undoubtedly the issue here. There are plenty of examples in the docs that showcase row selection. There is no need for useEffect at all for this and in general with Tanstack and React as most of the state is either managed by Tanstack Table or via your own useState hooks. Check out the documentation and remove the useEffect.
rival-black
rival-black17mo ago
The main weird thing that I see here is that you are not passing the state back to the table.
No description
rival-black
rival-black17mo ago
So just pass in the rowSelection state and it should work like normal
fair-rose
fair-roseOP16mo ago
Yup, I should probably review my code with your explanations. Thanks for the tips 👍

Did you find this page helpful?