use-infinite-scroll
A react hook to use infinite scroll
Install
npm install --save use-infinite-scrollyarn add use-infinite-scroll
Demo
https://y2507wpz01.codesandbox.io/
Usage
import React useState useEffect from 'react'import useInfiniteScroll from 'use-infinite-scroll' const Example = // Note: If you don't set initial value for items, // use useEffect(fetchData, []) to load data initially, // see example/src/App.js for usecase const items setItems = ; const isFetching setIsFetching = // replace this with your own data fetch function { ; } return <div> <ul> items </ul> isFetching ? 'Fetching...' : 'Not Fetching' </div> // see this code live at https://y2507wpz01.codesandbox.io/
License
MIT © abdullahtariq1171
created using create-react-hook.