README
react-infinite-scroll-using-hooks
A react infinite scroll using React Hooks and Intersection Observer API. The scroller exposes scroll handler for scroll position persistance. It is designed so as to accept custom styles.
installation
npm i --save react-infinite-scroll-using-hooks
Usagae
import InfiniteScroller from "react-infinite-scroll-using-hooks";
<InfiniteScroller
listItems={}
isMore=true
fetchMore={() => loadMoreCallBack()}
scrollHandler={x => setLastScrollPosition(x)}
initialScrollPos={lastScrollPosition}
renderItems={item => <Card></Card>}
/>
Props
renderItems
(function) iterator functionloader
(function) returning loader componentscrollHandler
(function) onScroll callbackendOfLine
(function) returning end of list componentisLoading
(bool) true if list fetch is in progressisMore
(bool) true if more items are availablelistItems
(array) items array to iterate overfetchMore
(function) fetch more callbackwrapperStyle
(Object) custom style of wrapperthreshold
(Number) IntersectionObserver option param (0-1) by default 0rootMargin
(Dimension in px) IntersectionObserver option param and by default 0