ReactPaginate for unknown pageCount #381
-
Hi, I there a way to use ReactPaginate for such a usecase? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The backend is responsible for sending how many pages it has available for this specific use case. This is a must with API's that involve pagination. If for some reason it doesn't send the amount of pages you could write a function to fetch all available pages and then get the amount of pages from it. This is not idealy for obvious reasons.. That's why the API needs to return the amount of pages. |
Beta Was this translation helpful? Give feedback.
-
I've had to tackle this just today and my approach was to set page count to the (current page + 1) if the current page has a full page size of results. If using pagination using tokens, you can check for a next page token instead and set to (current +1) if there is, (current) if there isn't. |
Beta Was this translation helpful? Give feedback.
The backend is responsible for sending how many pages it has available for this specific use case. This is a must with API's that involve pagination.
If for some reason it doesn't send the amount of pages you could write a function to fetch all available pages and then get the amount of pages from it. This is not idealy for obvious reasons.. That's why the API needs to return the amount of pages.