Which vars to watch as dependencies for a 'table updated/sorted/repaginated' useEffect?
I have a paginated, sortable React (NextJS) table listing 500+ items.
And I want to make a secondary, expensiveAPI call for only the 50-100 visible rows in the table each time it re-renders, then augment the table with this extra data.
Currently I'm only watching pagination in the dependency array because it seems that sorting also triggers pagination. However, this approach logs the visible rows twice in quick succession.
Is there a more efficient way to do this? What should be in the dependency array to catch all table updates?
0 Replies