These libraries solve the problem of displaying large lists in React applications without crashing the browser. react-window and react-virtualized use virtualization to render only the visible items, recycling DOM nodes to keep memory usage low. react-infinite-scroll-component appends items to the DOM as the user scrolls, which is simpler but can cause performance issues with very large data sets. react-tiny-virtual-list offers a lightweight virtualization approach with a simpler API than the larger frameworks. Choosing the right tool depends on whether you need true virtualization for performance or a simple append-on-scroll behavior for easier implementation.
When building React applications, rendering long lists can slow down your app or crash the browser. The packages react-window, react-virtualized, react-tiny-virtual-list, and react-infinite-scroll-component solve this problem in different ways. The key difference lies in how they handle DOM nodes: virtualization recycles nodes, while infinite scroll keeps appending them. Let's compare how they work in real engineering scenarios.
react-window renders only the items visible in the viewport. It creates a fixed container and moves items within it as you scroll.
import { FixedSizeList } from 'react-window';
const List = ({ items }) => (
<FixedSizeList height={500} itemCount={items.length} itemSize={35} width={300}>
{({ index, style }) => (
<div style={style}>
{items[index]}
</div>
)}
</FixedSizeList>
);
react-virtualized works similarly but uses a slightly older API structure with explicit row renderers.
import { List } from 'react-virtualized';
const List = ({ items }) => (
<List
height={500}
rowCount={items.length}
rowHeight={35}
width={300}
rowRenderer={({ index, key, style }) => (
<div key={key} style={style}>
{items[index]}
</div>
)}
/>
);
react-tiny-virtual-list provides a similar virtualization experience with a simpler prop structure focused on rendering items.
import VirtualList from 'react-tiny-virtual-list';
const List = ({ items }) => (
<VirtualList
width={300}
height={500}
itemCount={items.length}
itemSize={35}
renderItem={({ index }) => (
<div key={index}>
{items[index]}
</div>
)}
/>
);
react-infinite-scroll-component does not virtualize. It renders all children and appends more as you reach the bottom. This means DOM nodes accumulate over time.
import InfiniteScroll from 'react-infinite-scroll-component';
const List = ({ items, fetchMore }) => (
<InfiniteScroll
dataLength={items.length}
next={fetchMore}
hasMore={true}
loader={<h4>Loading...</h4>}
height={500}
>
{items.map((item, index) => (
<div key={index}>{item}</div>
))}
</InfiniteScroll>
);
Managing the width and height of the list container is critical for virtualization to calculate visible items correctly.
react-window includes a separate AutoSizer component to fill the parent container automatically.
import { FixedSizeList } from 'react-window';
import AutoSizer from 'react-virtualized-auto-sizer';
const List = ({ items }) => (
<AutoSizer>
{({ height, width }) => (
<FixedSizeList height={height} width={width} itemCount={items.length} itemSize={35}>
{({ index, style }) => <div style={style}>{items[index]}</div>}
</FixedSizeList>
)}
</AutoSizer>
);
react-virtualized also uses AutoSizer but integrates it tightly within its own ecosystem.
import { List, AutoSizer } from 'react-virtualized';
const List = ({ items }) => (
<AutoSizer>
{({ height, width }) => (
<List
height={height}
width={width}
rowCount={items.length}
rowHeight={35}
rowRenderer={({ index, key, style }) => <div key={key} style={style}>{items[index]}</div>}
/>
)}
</AutoSizer>
);
react-tiny-virtual-list typically requires manual width and height props or CSS styling on the wrapper element.
import VirtualList from 'react-tiny-virtual-list';
const List = ({ items }) => (
<div style={{ width: '100%', height: '500px' }}>
<VirtualList
width={300}
height={500}
itemCount={items.length}
itemSize={35}
renderItem={({ index }) => <div key={index}>{items[index]}</div>}
/>
</div>
);
react-infinite-scroll-component relies on CSS or explicit height props to define the scrollable area.
import InfiniteScroll from 'react-infinite-scroll-component';
const List = ({ items, fetchMore }) => (
<div style={{ height: '500px', overflow: 'auto' }}>
<InfiniteScroll
dataLength={items.length}
next={fetchMore}
hasMore={true}
loader={<h4>Loading...</h4>}
height={500}
>
{items.map((item, index) => <div key={index}>{item}</div>)}
</InfiniteScroll>
</div>
);
Fetching additional data as the user scrolls is a common requirement. The implementation differs between virtualizers and infinite scroll wrappers.
react-window does not handle data fetching internally. You must track the scroll index and trigger fetches manually.
import { FixedSizeList } from 'react-window';
const List = ({ items, fetchMore }) => {
const onItemsRendered = ({ visibleStopIndex }) => {
if (visibleStopIndex >= items.length - 5) fetchMore();
};
return (
<FixedSizeList height={500} itemCount={items.length} itemSize={35} width={300} onItemsRendered={onItemsRendered}>
{({ index, style }) => <div style={style}>{items[index]}</div>}
</FixedSizeList>
);
};
react-virtualized uses a similar manual approach with the onRowsRendered callback.
import { List } from 'react-virtualized';
const List = ({ items, fetchMore }) => (
<List
height={500}
rowCount={items.length}
rowHeight={35}
width={300}
onRowsRendered={({ stopIndex }) => {
if (stopIndex >= items.length - 5) fetchMore();
}}
rowRenderer={({ index, key, style }) => <div key={key} style={style}>{items[index]}</div>}
/>
);
react-tiny-virtual-list requires you to implement logic outside the component to check scroll position or rendered indices.
import VirtualList from 'react-tiny-virtual-list';
const List = ({ items, fetchMore }) => (
<VirtualList
width={300}
height={500}
itemCount={items.length}
itemSize={35}
renderItem={({ index }) => <div key={index}>{items[index]}</div>}
// You must wrap this or use refs to track scroll for fetchMore
/>
);
react-infinite-scroll-component has data loading built-in via the next prop, making it the easiest to set up for simple feeds.
import InfiniteScroll from 'react-infinite-scroll-component';
const List = ({ items, fetchMore }) => (
<InfiniteScroll
dataLength={items.length}
next={fetchMore}
hasMore={true}
loader={<h4>Loading...</h4>}
height={500}
>
{items.map((item, index) => <div key={index}>{item}</div>)}
</InfiniteScroll>
);
Choosing a library involves considering its future support. Some packages are no longer actively developed.
react-window is actively maintained by Brian Vaughn at Vercel. It is the recommended path for virtualization in the React ecosystem.
// react-window is the current standard
import { FixedSizeList } from 'react-window';
react-virtualized is in maintenance mode. The author recommends migrating to react-window. Do not use it for new projects.
// react-virtualized is legacy
// Only use for existing projects
import { List } from 'react-virtualized';
react-tiny-virtual-list has less frequent updates but remains functional for simple use cases. Check the repository for recent activity before committing.
// react-tiny-virtual-list is stable but less active
import VirtualList from 'react-tiny-virtual-list';
react-infinite-scroll-component is widely used and maintained. It solves a different problem (appending vs virtualizing), so it remains relevant for specific UI patterns.
// react-infinite-scroll-component is active
import InfiniteScroll from 'react-infinite-scroll-component';
| Feature | react-window | react-virtualized | react-tiny-virtual-list | react-infinite-scroll-component |
|---|---|---|---|---|
| Strategy | Virtualization | Virtualization | Virtualization | DOM Appending |
| Maintenance | β Active | β οΈ Legacy | β οΈ Stable | β Active |
| API Complexity | Medium | High | Low | Low |
| AutoSizer | β External Component | β Built-in | β Manual | β Manual |
| Data Loading | β Manual | β Manual | β Manual | β Built-in |
| Performance | π High | π High | π High | β οΈ Degrades with size |
react-window is the best choice for most modern applications requiring virtualization. It balances performance with a maintainable codebase and active support.
react-infinite-scroll-component is perfect for social feeds or comment sections where simplicity matters more than handling tens of thousands of items.
react-virtualized should be avoided in new work. If you inherit a project using it, plan to migrate to react-window when possible.
react-tiny-virtual-list is a viable alternative if you need virtualization but find react-window too heavy or complex for your specific needs.
Choose react-window for new projects requiring high-performance virtualization. It is the modern successor to react-virtualized, maintained by the same author, and offers a smaller bundle size with a focused API. It is ideal for dashboards, data grids, and any list with thousands of rows where scrolling smoothness is critical.
Avoid react-virtualized for new projects as it is in maintenance mode and no longer receives feature updates. Only choose this if you are maintaining a legacy codebase that already depends on it, or if you need a specific feature not present in react-window like complex table headers with heavy customization.
Choose react-infinite-scroll-component when you need a simple infinite scroll effect and the total list size will remain manageable (e.g., under 1,000 items). It is best for social media feeds or comment sections where DOM node recycling is less critical than implementation speed.
Choose react-tiny-virtual-list if you need virtualization but want a simpler API with fewer dependencies than react-window. It works well for standard lists with fixed item heights where you do not need the advanced grid or table features of the larger libraries.
react-window is a component library that helps render large lists of data quickly and without the performance problems that often go along with rendering a lot of data. It's used in a lot of places, from React DevTools to the Replay browser.
If you like this project there are several ways to support it:
The following wonderful companies and individuals have sponsored react-window:
Begin by installing the library from NPM:
npm install react-window
TypeScript definitions are included within the published dist folder
Frequently asked questions can be found here.
Documentation for this project is available at react-window.vercel.app; version 1.x documentation can be found at react-window-v1.vercel.app.
Renders data with many rows.
| Name | Description |
|---|---|
| rowComponent | React component responsible for rendering a row. This component will receive an βΉοΈ The prop types for this component are exported as |
| rowCount | Number of items to be rendered in the list. |
| rowHeight | Row height; the following formats are supported:
β οΈ Dynamic row heights are not as efficient as predetermined sizes. It's recommended to provide your own height values if they can be determined ahead of time. |
| rowProps | Additional props to be passed to the row-rendering component. List will automatically re-render rows when values in this object change. β οΈ This object must not contain |
| Name | Description |
|---|---|
| className | CSS class name. |
| style | Optional CSS properties. The list of rows will fill the height defined by this style. |
| children | Additional content to be rendered within the list (above cells). This property can be used to render things like overlays or tooltips. |
| defaultHeight | Default height of list for initial render. This value is important for server rendering. |
| listRef | Ref used to interact with this component's imperative API. This API has imperative methods for scrolling and a getter for the outermost DOM element. βΉοΈ The |
| onResize | Callback notified when the List's outermost HTMLElement resizes. This may be used to (re)scroll a row into view. |
| onRowsRendered | Callback notified when the range of visible rows changes. |
| overscanCount | How many additional rows to render outside of the visible area. This can reduce visual flickering near the edges of a list when scrolling. |
| tagName | Can be used to override the root HTML element rendered by the List component. The default value is "div", meaning that List renders an HTMLDivElement as its root. β οΈ In most use cases the default ARIA roles are sufficient and this prop is not needed. |
Renders data with many rows and columns.
βΉοΈ Unlike List rows, Grid cell sizes must be known ahead of time.
Either static sizes or something that can be derived (from the data in CellProps) without rendering.
| Name | Description |
|---|---|
| cellComponent | React component responsible for rendering a cell. This component will receive an βΉοΈ The prop types for this component are exported as |
| cellProps | Additional props to be passed to the cell-rendering component. Grid will automatically re-render cells when values in this object change. β οΈ This object must not contain |
| columnCount | Number of columns to be rendered in the grid. |
| columnWidth | Column width; the following formats are supported:
|
| rowCount | Number of rows to be rendered in the grid. |
| rowHeight | Row height; the following formats are supported:
|
| Name | Description |
|---|---|
| className | CSS class name. |
| dir | Indicates the directionality of grid cells. βΉοΈ See HTML |
| style | Optional CSS properties. The grid of cells will fill the height and width defined by this style. |
| children | Additional content to be rendered within the grid (above cells). This property can be used to render things like overlays or tooltips. |
| defaultHeight | Default height of grid for initial render. This value is important for server rendering. |
| defaultWidth | Default width of grid for initial render. This value is important for server rendering. |
| gridRef | Imperative Grid API. βΉοΈ The |
| onCellsRendered | Callback notified when the range of rendered cells changes. |
| onResize | Callback notified when the Grid's outermost HTMLElement resizes. This may be used to (re)scroll a cell into view. |
| overscanCount | How many additional rows/columns to render outside of the visible area. This can reduce visual flickering near the edges of a grid when scrolling. |
| tagName | Can be used to override the root HTML element rendered by the List component. The default value is "div", meaning that List renders an HTMLDivElement as its root. β οΈ In most use cases the default ARIA roles are sufficient and this prop is not needed. |