followed pagination example from tanstack site, but not working, any feedback please?
I posted question on stackoveflow but no luck.
https://stackoverflow.com/questions/75819635/react-pagination-using-tanstack-react-query-buttons-are-not-working
Thanks in advance.
Stack Overflow
react pagination using tanstack react query, buttons are not working
I am using jsonplaceholder api and trying to fetch results on different pages, for that I am
using tanstack react query, however my buttons seem to not work? Can somebody please guide me in
the right
3 Replies
foreign-sapphire•3y ago
Did you fix the issue you found with the state not being updated?
on further troubleshooting , in next button onClick is not updating the state
rare-sapphireOP•3y ago
no it only works if I do it setPage((old)=>old+1)
also looks like useEffect is not required..
foreign-sapphire•3y ago
If you console.log
data?.hasMore, what do you get?