How to determine pagination direction
I'm trying to do manual pagination over a collection returned from Apollo GQL using Relay-style pagination.
I'm trying to figure out how to determine if
nextPage()
or previousPage()
was called so I know whether or not to call the fetchMore
function. When users page backwards, I simply offset the data accordingly
but currently I can't avoid calling fetchMore
on any pagination action because I have no way to know if I went backwards or forwards.
1 Reply
exotic-emerald•2y ago
You can read the current
pageIndex
in the table.getState().pagination.pageIndex
and compare it with the new value.
Or I didn't understand the question correctly?