upmostly/react-hooks-infinite-scroll

Prevent from fetching when no more datas

LaurentSanson opened this issue · 1 comments

Hi,

I was wondering how would you prevent from fetching when there's no more data?

I've implemented your work in my project, but it keeps fetching when I'm scrolling down to the bottom page...

Cheers

first of all, we should to known that there is no data from frontend client, you can return a totalPages from backend api, such like this :

image

In this way, you can find whether there is more data to load based on currentPage and totalPages.
from your question, this is the way I used it in my project.