react-infinite-list-observer
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

react-infinite-list-observer

Demo

Playground here

install

npm install react-infinite-list-observer

or

yarn add react-infinite-list-observer

usage

const listRef = useRef<ListHandler>(null);

const onSomething = () => {
         if (listRef.current) {
            listRef.current.resetPage();
            listRef.current.scrollToTop();
          }
]

 <List
        ref={listRef}
        hasMore={hasMore}
        list={items}
        height={400} // optional
        onFetchMore={fetchMore}
        renderItem={(item) => {
          return (
           <div key={item.id}>{item.name}</div>
          );
        }}
      />

#props

Prop description
list T
renderItem method returns JSX
hasMore boolean
onFetchMore method used to fetch more data
currentPage optional - number
height optional - number
className used for styling
ref optional: attach ref - allows you to reset the page / scroll to top

Readme

Keywords

none

Package Sidebar

Install

npm i react-infinite-list-observer

Weekly Downloads

1

Version

1.0.9

License

none

Unpacked Size

2.48 kB

Total Files

2

Last publish

Collaborators

  • flaviusbadescu