react-hooks-infinite-scroll icon indicating copy to clipboard operation
react-hooks-infinite-scroll copied to clipboard

Prevent from fetching when no more datas

Open LaurentSanson opened this issue 5 years ago • 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

LaurentSanson avatar Oct 29 '20 16:10 LaurentSanson

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.

hippieZhou avatar Jul 24 '22 11:07 hippieZhou