react-infinite-scroller
react-infinite-scroller copied to clipboard
Is it possible to reset the start page when requesting new data or switching the filter?
Is your feature request related to a problem? Please describe. Hi, I ran into such a problem that when requesting new data, the home page counter remains from the previous request.
That is: I scrolled, got page number 4, then I switch the filter, start scrolling the page and my request starts from page 5, and I would like to start from 1.
I had similar requirement. I set separate state for page counting, request end points so whenever user change the filter It will change the state so the request is starting from page one. This is how I solved the requirement.
const isRef = useRef(null);
<InfiniteScroll
ref={isRef}
....
/>
// Reset the start page
isRef.current.pageLoaded = 0;