plurall-infinite-list
v1.4.34
Published
This component encapsulates the infinite scroll list used in many of our applications.
Downloads
8
Readme
PlurallInfiniteList
This component encapsulates the infinite scroll list used in many of our applications.
How to use
There are four required props:
- endpoint: the url you want to fetch
- accessToken: the api access token
- renderItem: a render function that will be called for each item the api returns
- renderLoadButton: a render function for the
load more
button. This function receives the components props as the first parameter.
Example:
<InfiniteListContainer
endpoint="InfiniteListContainer"
accessToken="123"
renderItem={post => <div>{post.title}</div>}
renderLoadButton={props => <button>Load {props.pageSize} More</button>}
>
Optional props
- renderLoading: a render function for the 'loading' placeholder that will be shown as the api request is made.
- apiPageNumberParameterName: the name of the parameter the api uses to indicate the page to be fetched.
- apiPageSizeParameterName: the name of the parameter the api uses to indicate the number of results per page.
- pageSize: the number of results per page.
- keyName: the item property to be used as key on the list.