react-virtualized, react-window, and react-virtual are libraries designed to handle rendering large datasets efficiently in React. They use a technique called windowing or virtualization, which only renders the items currently visible in the viewport. This approach drastically reduces DOM node count and improves scrolling performance. While react-virtualized is the legacy option with many built-in components, react-window is its lighter, modern successor focused on core windowing. react-virtual (now part of TanStack) offers a headless, hook-based approach that works across multiple frameworks.
When building data-heavy dashboards or feeds, rendering thousands of DOM nodes at once will slow down your application. react-virtualized, react-window, and react-virtual solve this by only rendering the items currently visible on the screen. While they share the same goal, their architectures and maintenance status differ significantly. Let's compare how they handle common engineering challenges.
react-virtualized relies on heavy class-based components.
<List> or <Grid>.// react-virtualized: Component-based
import { List } from 'react-virtualized';
<List
width={600}
height={400}
rowCount={1000}
rowHeight={50}
rowRenderer={({ index, style }) => (
<div style={style}>Row {index}</div>
)}
/>
react-window uses function components with a render prop pattern.
<FixedSizeList> or <VariableSizeList>.index and style.// react-window: Component with render prop
import { FixedSizeList } from 'react-window';
<FixedSizeList
width={600}
height={400}
itemCount={1000}
itemSize={50}
>
{({ index, style }) => (
<div style={style}>Row {index}</div>
)}
</FixedSizeList>
react-virtual provides a headless hook.
useVirtualizer to get virtual items.// react-virtual: Hook-based
import { useVirtualizer } from '@tanstack/react-virtual';
const virtualizer = useVirtualizer({
count: 1000,
getScrollElement: () => parentRef.current,
estimateSize: () => 50,
});
return (
<div ref={parentRef} style={{ height: '400px', overflow: 'auto' }}>
<div style={{ height: virtualizer.getTotalSize() }}>
{virtualizer.getVirtualItems().map((virtualItem) => (
<div key={virtualItem.key} style={{ transform: `translateY(${virtualItem.start}px)` }}>
Row {virtualItem.index}
</div>
))}
</div>
</div>
);
Resizing the virtual list when the window or container changes is a common requirement.
react-virtualized includes <AutoSizer> out of the box.
// react-virtualized: Built-in AutoSizer
import { List, AutoSizer } from 'react-virtualized';
<AutoSizer>
{({ height, width }) => (
<List
width={width}
height={height}
rowCount={1000}
rowHeight={50}
rowRenderer={({ index, style }) => (
<div style={style}>Row {index}</div>
)}
/>
)}
</AutoSizer>
react-window requires a separate package.
react-virtualized-auto-sizer.// react-window: External AutoSizer
import { FixedSizeList } from 'react-window';
import AutoSizer from 'react-virtualized-auto-sizer';
<AutoSizer>
{({ height, width }) => (
<FixedSizeList
width={width}
height={height}
itemCount={1000}
itemSize={50}
>
{({ index, style }) => (
<div style={style}>Row {index}</div>
)}
</FixedSizeList>
)}
</AutoSizer>
react-virtual handles resizing via observers.
// react-virtual: Observer-based
import { useVirtualizer } from '@tanstack/react-virtual';
const parentRef = useRef(null);
const virtualizer = useVirtualizer({
count: 1000,
getScrollElement: () => parentRef.current,
estimateSize: () => 50,
// ResizeObserver is handled internally
});
return (
<div ref={parentRef} style={{ overflow: 'auto' }}>
{/* Virtual items rendered here */}
</div>
);
Long-term support is critical when choosing infrastructure libraries.
react-virtualized is in maintenance mode.
react-window for new work.// react-virtualized: Legacy status
// ā ļø Not recommended for new projects
import { List } from 'react-virtualized';
react-window is actively maintained.
react-virtualized.// react-window: Active standard
// ā
Recommended for React-specific projects
import { FixedSizeList } from 'react-window';
react-virtual is part of the TanStack ecosystem.
// react-virtual: Modern headless
// ā
Recommended for custom layouts or non-React frameworks
import { useVirtualizer } from '@tanstack/react-virtual';
Despite their differences, all three libraries solve the same core problem using similar underlying math.
// All libraries: Render only visible items
// Instead of 1000 divs, only ~10 are in the DOM
transform or top/left.// All libraries: Use inline styles for position
style={{ transform: `translateY(${offset}px)` }}
// All libraries: Listen to scroll events
// Internal logic calculates startIndex and endIndex
| Feature | react-virtualized | react-window | react-virtual |
|---|---|---|---|
| API Style | š§± Class Components | āļø Function Components | šŖ Hooks (Headless) |
| Bundle Size | š Heavy | šŖ¶ Light | šŖ¶ Light |
| AutoSizer | ā Built-in | ā Separate Package | ā Internal Observer |
| Maintenance | ā ļø Legacy | ā Active | ā Active |
| Framework | āļø React Only | āļø React Only | š Framework Neutral |
react-virtualized is the legacy option š°ļø ā avoid it for new work unless you are stuck maintaining old code. It has too much weight for modern apps.
react-window is the standard choice š for React projects ā it is light, stable, and does exactly what most teams need without extra complexity.
react-virtual is the flexible choice š ļø for custom needs ā use it if you need headless logic, custom layouts, or support for frameworks beyond React.
Final Thought: For most React developers, react-window offers the best balance of performance and ease of use. If you need more control or framework neutrality, react-virtual is the modern alternative.
Choose react-virtualized only if you are maintaining an existing codebase that already depends on it. It includes many built-in components like Grid and Table, but it is heavier and no longer receives active feature development. For new projects, this package is considered legacy and should be avoided in favor of lighter alternatives.
Choose react-virtual if you want a headless solution that gives you full control over rendering logic. It uses hooks instead of components, making it flexible for custom layouts or non-React frameworks like Solid or Vue. This option requires more setup but avoids locking you into specific component structures.
Choose react-window if you need a reliable, React-specific solution for lists or grids with minimal overhead. It is the recommended successor to react-virtualized by the same author and offers better performance for standard use cases. You will need to pair it with react-virtualized-auto-sizer for dynamic container sizing.
React components for efficiently rendering large lists and tabular data. Check out the demo for some examples.
The following wonderful companies have sponsored react-virtualized:
Learn more about becoming a sponsor!
react-windowIf you're considering adding react-virtualized to a project, take a look at react-window as a possible lighter-weight alternative. Learn more about how the two libraries compare here.
Install react-virtualized using npm.
npm install react-virtualized --save
ES6, CommonJS, and UMD builds are available with each distribution. For example:
// Most of react-virtualized's styles are functional (eg position, size).
// Functional styles are applied directly to DOM elements.
// The Table component ships with a few presentational styles as well.
// They are optional, but if you want them you will need to also import the CSS file.
// This only needs to be done once; probably during your application's bootstrapping process.
import 'react-virtualized/styles.css';
// You can import any component you want as a named export from 'react-virtualized', eg
import {Column, Table} from 'react-virtualized';
// But if you only use a few react-virtualized components,
// And you're concerned about increasing your application's bundle size,
// You can directly import only the components you need, like so:
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
import List from 'react-virtualized/dist/commonjs/List';
Note webpack 4 makes this optimization itself, see the documentation.
If the above syntax looks too cumbersome, or you import react-virtualized components from a lot of places, you can also configure a Webpack alias. For example:
// Partial webpack.config.js
{
alias: {
'react-virtualized/List': 'react-virtualized/dist/es/List',
},
...rest
}
Then you can just import like so:
import List from 'react-virtualized/List';
// Now you can use <List {...props} />
You can also use a global-friendly UMD build:
<link rel="stylesheet" href="path-to-react-virtualized/styles.css" />
<script src="path-to-react-virtualized/dist/umd/react-virtualized.js"></script>
Now you're ready to start using the components. You can learn more about which components react-virtualized has to offer below.
React Virtualized has very few dependencies and most are managed by NPM automatically.
However the following peer dependencies must be specified by your project in order to avoid version conflicts:
react,
react-dom.
NPM will not automatically install these for you but it will show you a warning message with instructions on how to install them.
By default all react-virtualized components use shallowCompare to avoid re-rendering unless props or state has changed.
This occasionally confuses users when a collection's data changes (eg ['a','b','c'] => ['d','e','f']) but props do not (eg array.length).
The solution to this is to let react-virtualized know that something external has changed. This can be done a couple of different ways.
The shallowCompare method will detect changes to any props, even if they aren't declared as propTypes.
This means you can also pass through additional properties that affect cell rendering to ensure changes are detected.
For example, if you're using List to render a list of items that may be re-sorted after initial render- react-virtualized would not normally detect the sort operation because none of the properties it deals with change.
However you can pass through the additional sort property to trigger a re-render.
For example:
<List {...listProps} sortBy={sortBy} />
Grid and Collection components can be forcefully re-rendered using forceUpdate.
For Table and List, you'll need to call forceUpdateGrid to ensure that the inner Grid is also updated. For MultiGrid, you'll need to call forceUpdateGrids to ensure that the inner Grids are updated.
API documentation available here.
There are also a couple of how-to guides:
Examples for each component can be seen in the documentation.
Here are some online demos of each component:
And here are some "recipe" type demos:
react-virtualized aims to support all evergreen browsers and recent mobile browsers for iOS and Android. IE 9+ is also supported (although IE 9 will require some user-defined, custom CSS since flexbox layout is not supported).
If you find a browser-specific problem, please report it along with a repro case. The easiest way to do this is probably by forking this Plunker.
Here are some great components built on top of react-virtualized:
Use GitHub issues for requests.
I actively welcome pull requests; learn how to contribute.
Changes are tracked in the changelog.
react-virtualized is available under the MIT License.