T
TanStack14mo ago
grumpy-cyan

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
genetic-orange
genetic-orange14mo 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.
like-gold
like-gold14mo ago
The main weird thing that I see here is that you are not passing the state back to the table.
No description
like-gold
like-gold14mo ago
So just pass in the rowSelection state and it should work like normal
grumpy-cyan
grumpy-cyanOP13mo ago
Yup, I should probably review my code with your explanations. Thanks for the tips 👍

Did you find this page helpful?