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 am running into much difficulties trying to understand how the useTable hook is running into a recursive loop. I created a very small example in this snippet of code below. In the useMemo for the data item, passing foo or fooArr as the dependency results in the "maximum update depth exceeded" loop.
If I pass in an empty array, it works. So is the variable num. However, if num is changed by clicking on the div, the "IN" message is never printed.
Does a primitive like num require useState? The real use case is to put the length of the array returned by useSWR as the dependency. Putting the resulting data array as the dependency results in the loop.
I made a similar example with just useMemo and that wasn't the problem, though num didn't work as well.
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
-
Hi,
I am running into much difficulties trying to understand how the useTable hook is running into a recursive loop. I created a very small example in this snippet of code below. In the useMemo for the data item, passing foo or fooArr as the dependency results in the "maximum update depth exceeded" loop.
If I pass in an empty array, it works. So is the variable num. However, if num is changed by clicking on the div, the "IN" message is never printed.
Does a primitive like num require useState? The real use case is to put the length of the array returned by useSWR as the dependency. Putting the resulting data array as the dependency results in the loop.
I made a similar example with just useMemo and that wasn't the problem, though num didn't work as well.
This is react-table v7.7.0.
Thanks
Matt
Beta Was this translation helpful? Give feedback.
All reactions