Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 1009 Bytes

InfiniteScroll.md

File metadata and controls

27 lines (19 loc) · 1009 Bytes

<InfiniteScroll>

Fires loadMore prop when end of content becomes visible.

Usage

import {InfiniteScroll} from 'libreact/lib/InfiniteScroll';

<InfiniteScroll
  hasMore={true || false}
  cursor={cursor}
  loadMore={() => {/* ... */}}
>
  {items}
</InfiniteScroll>

Props

  • loadMore — required, function that is called when user scrolls to the bottom of the component.
  • cursor — required, unique identifier of current page, loadMore is called only once for each adjacent unique value of cursor.
  • hasMore — optional, boolean, whether there are more items to load, if set to false, loadMore will not be called.
  • sentinel — optional, React element to render at the bottom of the component, when this element becomes visible it triggers loadMore function, defaults to empty <div> pixel.
  • margin — optional, number, invisible margin before sentinel when to already call loadMore before sentinel is visible, defaults to 100.