You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use @tanstack/react-table and put the useReactTable table inside a react context.
It seems like the table instance stays stable and hence stuff like table.getSelectedRowModel() does not rerender when used inside the subcomponent. I want that the getter functions from react-table will force the component to rerender when it consumes a getter function value that changes.
One solution that I think can work is to create another some small context providers. They will hold react state and update it on changes - for example
So the rowSelection dependency change will change the context value - and I could safely get it.
This is relevant to all the all the table methods (like pinning, columnSelection. columnResizing).
Is it consider best practice? How to make my component to response to updates?
Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use @tanstack/react-table and put the useReactTable table inside a react context.
It seems like the table instance stays stable and hence stuff like table.getSelectedRowModel() does not rerender when used inside the subcomponent. I want that the getter functions from react-table will force the component to rerender when it consumes a getter function value that changes.
One solution that I think can work is to create another some small context providers. They will hold react state and update it on changes - for example
So the rowSelection dependency change will change the context value - and I could safely get it.
This is relevant to all the all the table methods (like pinning, columnSelection. columnResizing).
Is it consider best practice? How to make my component to response to updates?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions