1.2.1 • Published 5 years ago

react-infinite-scroll-io v1.2.1

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

React Infinite Scroll - Intersection Observer

Installation

npm i react-infinite-scroll-io

How To Use

First import this component where you want to use it

import InfiniteScroll from "react-infinite-scroll-io"

Then just render it:

<InfiniteScroll
    name="your-list"
    items={users}
    errorMessage="No users found"

    renderCallback={this.renderUser.bind(this)}
    loadMoreCallback={this.props.loadMoreUsers}
    loadMoreParams={['john', 1]}
    spinner={<div class="spinner">Loading...</div>}

    isFetching={this.props.isFetching}
    isLoadingMore={this.props.isLoadingMore}
    isLoadComplete={this.props.isLoadComplete}

    resetStateIfValueChanged={}
/>

Props (all props are required)

PropDescriptionType
nameclassName of the componentString
itemsArray of items to renderArray
errorMessageMessage shown if an array is emptyString
maxHeight?Max. height of the scrollable areaString
renderCallbackRender function for array itemsFunction(returns JSX)
loadMoreCallbackAPI call returning itemsFunction
loadMoreParamsParams to pass to a loadMoreCallbackArray
spinnerA component that shown while loadingJSX
isFetchingNotifies that initial fetching is in progressBoolean
isLoadingMoreNotifies that loading more is in progressBoolean
isLoadCompleteNotifies that loading is completeBoolean
resetStateIfValueChangedA value(s) that reset scroll/page if changedPrimitive/Array of primitives