yarn add react-endless-scroll
or
npm install react-endless-scroll
https://tropical32.github.io/react-endless-scroll-demo/
https://www.npmjs.com/package/react-endless-scroll
import EndlessScroll from 'react-endless-scroll'
<EndlessScroll
onReachBottom={fetch}
isLoading={isLoading}
hasMore={hasMore}
>
{items.map((item) => (
<div>{item}</div>
))}
</EndlessScroll>
The function to be called upon reaching the bottom of the list
Whether the fetching function is busy fetching
Whether the fetching function has more data to fetch
Components to render
Determines, in percent, how much of the bottom 100 pixels of the list has to be "seen" in order to trigger onReachBottom
class name of the top level wrapper