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
First, if someone could point me to more documentation on the "magic" ...rest args for the useTable hook, I would be grateful. Many examples reference passing an "on the fly" plugin for a lack of better terms, but nowhere in the documentation is this functionality elaborated on. I wish I could ask the question better, but given there seems to be 0 documentation, I don't even know what to call this "last argument"
Anyways, to my problem. In a previous version of react-table (possible the alpha version of v7) outside state would be reflected inside of the visibleColumns function closures. However it is apparent now that these functions are being memoized more heavily. I have tried a variety of solutions to get around this. Here is a very small example illustrating the problem. Notice when you click toggle selected, nothing happens, whereas previously the function would re-run with the most up to date reference. https://codesandbox.io/s/billowing-cherry-yv559?file=/src/App.js
I feel like I have spent enough time spelunking through the source here and still not sure of the best way to handle this. Is there better documentation for writing "hook plugins" anywhere?
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.
-
First, if someone could point me to more documentation on the "magic"
...rest
args for theuseTable
hook, I would be grateful. Many examples reference passing an "on the fly" plugin for a lack of better terms, but nowhere in the documentation is this functionality elaborated on. I wish I could ask the question better, but given there seems to be 0 documentation, I don't even know what to call this "last argument"Anyways, to my problem. In a previous version of react-table (possible the alpha version of v7) outside state would be reflected inside of the visibleColumns function closures. However it is apparent now that these functions are being memoized more heavily. I have tried a variety of solutions to get around this. Here is a very small example illustrating the problem. Notice when you click toggle selected, nothing happens, whereas previously the function would re-run with the most up to date reference. https://codesandbox.io/s/billowing-cherry-yv559?file=/src/App.js
I feel like I have spent enough time spelunking through the source here and still not sure of the best way to handle this. Is there better documentation for writing "hook plugins" anywhere?
Beta Was this translation helpful? Give feedback.
All reactions