0.1.0 • Published 1 year ago

react-dynamic-lazy-virtual-scroll v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-dynamic-lazy-virtual-scroll

React Dynamic Virtual Scroll is a lightweight and customizable library for efficiently rendering large lists in React applications. By utilizing the virtual scrolling technique, it renders only the visible items in the list, resulting in faster load times and smoother scrolling experiences.

Installation

npm install react-dynamic-lazy-virtual-scroll

No external dependencies so no need to worry about security and package size.

Usage

  • Import component.

    import VirtualScroll from "react-dynamic-lazy-virtual-scroll";
  • Add component:

    <VirtualScroll
        className="List"
        minItemHeight={40}
        totalLength={100}
        renderItem={(rowIndex) => {
            return (
              <div className="List-item">
                <h3>List item: {rowIndex}</h3>
              </div>
            );
        }}
    />

Props Table

nametyperequireddefaultdescription
minItemHeightnumber*Smallest item height to calculate placeholder spacing.
totalLengthnumber*Total amount of items to be displayed.
renderItem(rowIndex) => React.ReactNode*Function to display items for specific index values. Indexed at 0.
lengthnumber30Total number of items to be rendered in the dom.
buffernumber10Total number of items to be displayed in the DOM before and after the required items.
0.1.0

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago