bvaughn/react-window-infinite-loader
소개
react-virtualized에서 영감을 받아 react-window용으로 만든 InfiniteLoader 컴포넌트입니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalreact-window-infinite-loader
Infinite loader utils inspired by react-virtualized but for use with react-window.
If you like this project, 🎉 become a sponsor or ☕ buy me a coffee.
Installation
Begin by installing the library from NPM:
npm install react-window-infinite-loader
Documentation
The recommended way to use this library is the new useInfiniteLoader hook:
import { useInfiniteLoader } from "react-window-infinite-loader";
function Example() {
const onRowsRendered = useInfiniteLoader(props);
return <List onRowsRendered={onRowsRendered} {...rest} />;
}
The InfiniteLoader component also exists, though it has changed since version 1:
- Child function
onItemsRenderedparameter renamed toonRowsRendered - Child function
listRefparameter removed
import { InfiniteLoader } from "react-window-infinite-loader";
function Example() {
return (
<InfiniteLoader {...props}>
{({ onRowsRendered }) => <List onRowsRendered={onRowsRendered} {...rest} />}
</InfiniteLoader>
);
}
Components
InfiniteLoader
Loads rows as they are scrolled into view; a render prop alternative to the useInfiniteLoader hook.
Required props
| Name | Description |
|---|---|
| isRowLoaded | Function responsible for tracking the loaded state of each item. |
| loadMoreRows | Callback to be invoked when more rows must be loaded. It should return a Promise that is resolved once all data has finished loading. |
| rowCount | Number of rows in list; can be arbitrary high number if actual number is unknown. |
| children | Render prop that receives an |
Optional props
| Name | Description |
|---|---|
| minimumBatchSize | Minimum number of rows to be loaded at a time; defaults to 10. This property can be used to batch requests to reduce HTTP requests. |
| threshold | Threshold at which to pre-fetch data; defaults to 15. A threshold of 15 means that data will start loading when a user scrolls within 15 rows. |
Hooks
useInfiniteLoader
Loads rows as they are scrolled into view.
Returns: An onRowsRendered callback to pass to a react-window List
Parameters
| Name | Description |
|---|---|
| isRowLoaded | Function responsible for tracking the loaded state of each item. |
| loadMoreRows | Callback to be invoked when more rows must be loaded. It should return a Promise that is resolved once all data has finished loading. |
| minimumBatchSize? | Minimum number of rows to be loaded at a time; defaults to 10. This property can be used to batch requests to reduce HTTP requests. |
| threshold? | Threshold at which to pre-fetch data; defaults to 15. A threshold of 15 means that data will start loading when a user scrolls within 15 rows. |
| rowCount | Number of rows in list; can be arbitrary high number if actual number is unknown. |
관련 프로젝트 살펴보기
불러오는 중…