Gathering detailed insights and metrics for react-infinite-scroller
Gathering detailed insights and metrics for react-infinite-scroller
Gathering detailed insights and metrics for react-infinite-scroller
Gathering detailed insights and metrics for react-infinite-scroller
@types/react-infinite-scroller
TypeScript definitions for react-infinite-scroller
react-masonry-infinite
React component for masonry infinite grid. Based on Bricks.js, React Infinite Scroller and React Masonry Layout.
react-loading-infinite-scroller
Wrapper of react-infinite-scroller to shape better with a loading request list rendering
@larryyangsen/react-infinite-scroller
Infinite scroll component for React in ES6
⏬ Infinite scroll component for React in ES6
npm install react-infinite-scroller
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
3,298 Stars
257 Commits
509 Forks
21 Watching
2 Branches
1 Contributors
Updated on 25 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
14.1%
82,855
Compared to previous day
Last week
10.5%
409,837
Compared to previous week
Last month
12.9%
1,678,810
Compared to previous month
Last year
7.4%
18,795,907
Compared to previous year
1
1
28
Infinitely load a grid or list of items in React. This component allows you to create a simple, lightweight infinite scrolling page or element by supporting both window and scrollable elements.
npm install react-infinite-scroller --save
yarn add react-infinite-scroller
1import InfiniteScroll from 'react-infinite-scroller';
1<InfiniteScroll 2 pageStart={0} 3 loadMore={loadFunc} 4 hasMore={true || false} 5 loader={<div className="loader" key={0}>Loading ...</div>} 6> 7 {items} // <-- This is the content you want to load 8</InfiniteScroll>
1<div style="height:700px;overflow:auto;"> 2 <InfiniteScroll 3 pageStart={0} 4 loadMore={loadFunc} 5 hasMore={true || false} 6 loader={<div className="loader" key={0}>Loading ...</div>} 7 useWindow={false} 8 > 9 {items} 10 </InfiniteScroll> 11</div>
You can define a custom parentNode
element to base the scroll calulations on.
1<div style="height:700px;overflow:auto;" ref={(ref) => this.scrollParentRef = ref}> 2 <div> 3 <InfiniteScroll 4 pageStart={0} 5 loadMore={loadFunc} 6 hasMore={true || false} 7 loader={<div className="loader" key={0}>Loading ...</div>} 8 useWindow={false} 9 getScrollParent={() => this.scrollParentRef} 10 > 11 {items} 12 </InfiniteScroll> 13 </div> 14</div>
Name | Required | Type | Default | Description |
---|---|---|---|---|
children | Yes | Node | Anything that can be rendered (same as PropType's Node) | |
loadMore | Yes | Function | A callback when more items are requested by the user. Receives a single parameter specifying the page to load e.g. function handleLoadMore(page) { /* load more items here */ } } | |
element | Component | 'div' | Name of the element that the component should render as. | |
hasMore | Boolean | false | Whether there are more items to be loaded. Event listeners are removed if false . | |
initialLoad | Boolean | true | Whether the component should load the first set of items. | |
isReverse | Boolean | false | Whether new items should be loaded when user scrolls to the top of the scrollable area. | |
loader | Component | A React component to render while more items are loading. The parent component must have a unique key prop. | ||
pageStart | Number | 0 | The number of the first page to load, With the default of 0 , the first page is 1 . | |
getScrollParent | Function | Override method to return a different scroll listener if it's not the immediate parent of InfiniteScroll. | ||
threshold | Number | 250 | The distance in pixels before the end of the items that will trigger a call to loadMore . | |
useCapture | Boolean | false | Proxy to the useCapture option of the added event listeners. | |
useWindow | Boolean | true | Add scroll listeners to the window, or else, the component's parentNode . |
loadMore
If you experience double or non-stop calls to your loadMore
callback, make
sure you have your CSS layout working properly before adding this component in.
Calculations are made based on the height of the container (the element the
component creates to wrap the items), so the height of the container must equal
the entire height of the items.
1.my-container { 2 overflow: auto; 3}
Some people have found success using react-infinite-scroll-component.
isLoading
prop!This component doesn't make any assumptions about what you do in terms of API calls. It's up to you to store whether you are currently loading items from an API in your state/reducers so that you don't make overlapping API calls.
1loadMore() { 2 if(!this.state.isLoading) { 3 this.props.fetchItems(); 4 } 5}
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/11 approved changesets -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
82 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More