New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-infinite-scroll-reverse

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-infinite-scroll-reverse

React infinite scroll reverse component

2.0.1
Source
npm
Version published
Weekly downloads
93
3.33%
Maintainers
1
Weekly downloads
 
Created
Source

REACT INFINITE SCROLL REVERSE COMPONENT

How to use

import InfiniteScrollReverse from "react-infinite-scroll-reverse";

In your component

const [isLoading, setIsLoading] = useState(true);
const [itemsList, setItemsList] = useState([]);
const itemsListTotal = 100500;

function getItems(page) {
  setIsLoading(true);
  setTimeout(() => {
    setItemsList(prev => ([...prev, { id: `uniq${page}`, name: "Alex" }]));
    setIsLoading(false);
  }, 300)
}

useEffect(()=>{
  getItems(1);
}, [])

  
<InfinteScrollReverse
  className="itemsContainer"
  hasMore={itemsList.length < itemsListTotal}
  isLoading={isLoading}
  loadMore={getItems}
  loadArea={30}
>
  {itemsList.map(item => (
    <div key={item.id}>{item.name}</div>
  ))}
</InfinteScrollReverse>

Props

NameTypeDefaultisRequiredDescription
classNameStringInfiniteScrollReversefalseClass name of scroll container with overflow
hasMoreBooleanfalsetrueHas more triger
isLoadingBooleanfalsetrueData fetching triger, must be true when data is loading
loadMoreFunctiontrueLoad more function
loadAreaIntager30falseScroll area on top. Run loadMore function

Keywords

infinite

FAQs

Package last updated on 09 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts