react-virtual vs react-virtualized vs react-window
Virtualizing Large Lists in React Applications
react-virtualreact-virtualizedreact-windowSimilar Packages:

Virtualizing Large Lists in React Applications

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.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-virtual06,809158 kB105-MIT
react-virtualized027,0682.24 MB0a year agoMIT
react-window017,143209 kB12 months agoMIT

Virtualizing Large Lists in React Applications

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.

šŸ—ļø Architecture & API Style: Components vs Hooks

react-virtualized relies on heavy class-based components.

  • You import specific components like <List> or <Grid>.
  • Props are passed directly to configure behavior.
  • Less flexible for custom DOM structures.
// 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.

  • You wrap your items in <FixedSizeList> or <VariableSizeList>.
  • The child function provides index and style.
  • Cleaner API but still component-bound.
// 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.

  • You call useVirtualizer to get virtual items.
  • You map over the items and apply styles manually.
  • Maximum flexibility for custom layouts.
// 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>
);

šŸ“ Handling Container Sizes: Built-in vs External

Resizing the virtual list when the window or container changes is a common requirement.

react-virtualized includes <AutoSizer> out of the box.

  • Wraps the list and passes width/height props.
  • Convenient but adds bundle weight even if unused elsewhere.
// 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.

  • You must install react-virtualized-auto-sizer.
  • Keeps the core library lightweight.
  • API is nearly identical to the legacy version.
// 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.

  • The hook uses ResizeObserver internally.
  • No extra wrapper component needed.
  • You just need a ref on the scrollable parent.
// 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>
);

šŸ› ļø Maintenance & Future Proofing

Long-term support is critical when choosing infrastructure libraries.

react-virtualized is in maintenance mode.

  • The original author recommends react-window for new work.
  • Bugs are fixed, but no new features are added.
  • Larger bundle size due to legacy code.
// react-virtualized: Legacy status
// āš ļø Not recommended for new projects
import { List } from 'react-virtualized';

react-window is actively maintained.

  • Designed as the modern replacement for react-virtualized.
  • Stable API with focused scope.
  • Best choice for standard React lists and grids.
// react-window: Active standard
// āœ… Recommended for React-specific projects
import { FixedSizeList } from 'react-window';

react-virtual is part of the TanStack ecosystem.

  • Actively developed alongside TanStack Table and Query.
  • Framework-neutral (works with Solid, Vue, Svelte).
  • Best choice for custom needs or multi-framework teams.
// react-virtual: Modern headless
// āœ… Recommended for custom layouts or non-React frameworks
import { useVirtualizer } from '@tanstack/react-virtual';

šŸ¤ Similarities: Shared Ground Between Libraries

Despite their differences, all three libraries solve the same core problem using similar underlying math.

1. šŸ“‰ DOM Reduction

  • All three only render visible rows.
  • Keeps the DOM light even with 10,000+ items.
// All libraries: Render only visible items
// Instead of 1000 divs, only ~10 are in the DOM

2. šŸ“ Absolute Positioning

  • Items are positioned using transform or top/left.
  • Ensures smooth scrolling without layout thrashing.
// All libraries: Use inline styles for position
style={{ transform: `translateY(${offset}px)` }}

3. šŸ”„ Scroll Event Listening

  • All attach listeners to the scroll container.
  • Calculate visible range based on scroll offset.
// All libraries: Listen to scroll events
// Internal logic calculates startIndex and endIndex

šŸ“Š Summary: Key Differences

Featurereact-virtualizedreact-windowreact-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

šŸ’” The Big Picture

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.

How to Choose: react-virtual vs react-virtualized vs react-window

  • react-virtual:

    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.

  • react-virtualized:

    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.

  • react-window:

    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.

README for react-virtual

Table of Contents generated with DocToc

React Virtual Header

Hooks for virtualizing scrollable elements in React

#TanStack Join the community on Spectrum

Enjoy this library? Try the entire TanStack! React Query, React Table, React Charts, React Form

Visit react-virtual.tanstack.com for docs, guides, API and more!

Quick Features

  • Row, Column, and Grid virtualization
  • One single headless hook
  • Fixed, variable and dynamic measurement modes
  • Imperative scrollTo control for offset, indices and alignment
  • Custom scrolling function support (eg. smooth scroll)