react-virtualized is a React library providing a collection of high-performance components designed for efficiently rendering large datasets, such as extensive lists and complex tables. It employs a "windowing" or "virtualization" technique, rendering only the rows or cells currently visible in the viewport, which drastically improves performance and reduces memory consumption in data-heavy applications. The current stable version is 9.22.6. Recent releases primarily focus on updating peer dependencies to maintain compatibility with newer React versions (up to React 19) and addressing minor bug fixes or security enhancements like Trusted Types support, indicating a maintenance phase rather than active feature development. Key differentiators include its comprehensive suite of components (List, Table, Grid, Collection), flexible sizing options, and a robust architecture optimized for minimizing DOM nodes and reflows.
npm install react-virtualizedVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a basic virtualized list using `List` and `AutoSizer` components, efficiently rendering 10,000 items with a fixed row height.
Update your `react` and `react-dom` packages to versions compatible with `^16.3.0 || ^17.0.0 || ^18.0.0 || ^19.0.0`. Check `npm list react` and `npm list react-dom` to identify multiple or incompatible React instances.
Memoize `rowRenderer` using `useCallback`, ensure `rowHeight` and `rowCount` are stable values or derived from stable state/props. For dynamic row heights, use `CellMeasurer` or ensure a well-defined `getRowHeight` function.
Always provide explicit `width` and `height` props to virtualized components, or wrap them in an `<AutoSizer>` component to dynamically fill their parent's dimensions. Ensure the parent container of `AutoSizer` also has defined dimensions.
Verify that `react` and `react-dom` peer dependencies are met. Ensure you are using named imports correctly (e.g., `import { List } from 'react-virtualized'`). Check your bundler configuration for potential duplicate React instances.Ensure that the data array or `rowCount` is always initialized, even if empty, before rendering the virtualized component. For asynchronous data, conditionally render the component after data is loaded or provide a default empty array/zero count.
Ensure that any imperative calls on component refs are made only after the component has mounted (e.g., within `useEffect` with an empty dependency array or after a render). Double-check ref assignment and `null` checks before accessing ref properties.