ReactList is a versatile React component designed for rendering large, scrollable lists efficiently. It leverages virtualization techniques to render only the visible items, significantly improving performance for long lists. Currently at version 0.8.18, it maintains broad compatibility with React versions from 0.14 through 19. While a 0.x.x version suggests a pre-1.0 stable release, its ongoing compatibility with modern React indicates active maintenance. Key differentiators include support for different item sizing strategies via its `type` prop (uniform, variable, simple), custom item and items renderers, and flexible control over the scroll parent, making it adaptable to various UI layouts and performance needs. It focuses on providing a performant scrolling experience without over-rendering DOM elements.
npm install react-listVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic ReactList setup to render 1000 uniform items with a mock data loader, showcasing its infinite scroll capabilities within a fixed-height container.
Consult the GitHub repository's commit history or changelog (if available) for specific breaking changes between versions.
Ensure your custom `itemsRenderer` implementation includes `ref={ref}` on its primary container element, e.g., `<div ref={ref}>{items}</div>`.Set `type='variable'` when you intend to provide custom item size logic via `itemSizeEstimator` or `itemSizeGetter`.
Always use `npm install react-list` or `yarn add react-list` for installing the package.
Ensure `this.state.accounts` is properly populated before rendering the list and that `length={this.state.accounts.length}` accurately reflects the current data count. Add a null/undefined check inside `renderItem` for defensive rendering.Ensure the direct parent of `<ReactList />` has a defined height and `overflow: auto` or `overflow: scroll` styles. If a custom scroll parent is used, verify the `scrollParentGetter` correctly returns the scrollable DOM element or `window`.
For variable-sized items, set `type='variable'` and provide an `itemSizeGetter(index)` function that accurately returns the size of the item at that index. If exact sizes are unknown before rendering, consider `itemSizeEstimator`.