react-virtualized vs react-list vs react-tiny-virtual-list vs react-infinite vs react-window
React Virtualization and Infinite Scrolling Libraries
react-virtualizedreact-listreact-tiny-virtual-listreact-infinitereact-windowSimilar Packages:
React Virtualization and Infinite Scrolling Libraries

React Virtualization and Infinite Scrolling Libraries are tools that help render large lists or grids of items efficiently in React applications. These libraries use techniques like virtualization, which only renders the items currently visible in the viewport, and infinite scrolling, which loads more items as the user scrolls down. This approach significantly improves performance and reduces memory usage, making it ideal for applications with long lists or data-heavy interfaces. Popular libraries in this space include react-virtualized, react-window, and react-infinite, each offering unique features and optimizations for handling large datasets in a React-friendly way.

Npm Package Weekly Downloads Trend
3 Years
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-virtualized1,349,55027,0702.24 MB1a year agoMIT
react-list429,1531,97434.9 kB71a year agoMIT
react-tiny-virtual-list109,0282,499-547 years agoMIT
react-infinite7,2212,691243 kB102-BSD-3-Clause
react-window017,069208 kB119 days agoMIT
Feature Comparison: react-virtualized vs react-list vs react-tiny-virtual-list vs react-infinite vs react-window

Virtualization Technique

  • react-virtualized:

    react-virtualized provides a comprehensive set of components for virtualization, including support for fixed and dynamic heights, grids, and tables. It is highly customizable and can handle complex layouts, making it suitable for a wide range of applications that require advanced virtualization techniques.

  • react-list:

    react-list supports virtualization by rendering only the visible items in the list, which reduces the number of DOM nodes and improves performance. It can handle dynamic item heights, making it versatile for lists with varying content sizes.

  • react-tiny-virtual-list:

    react-tiny-virtual-list uses virtualization to render only the items that are currently visible in the viewport. It is designed to be lightweight and efficient, minimizing the number of rendered items to improve performance, especially in large lists.

  • react-infinite:

    react-infinite implements infinite scrolling by loading more items as the user scrolls down. It does not use virtualization, which means all items are rendered in the DOM, but it efficiently manages the loading of additional items to create a seamless scrolling experience.

  • react-window:

    react-window is a lightweight library for virtualization that focuses on simplicity and performance. It renders only the visible items in a list or grid, reducing the number of DOM nodes and improving rendering speed. It is designed to be easy to use while providing efficient virtualization for large datasets.

Bundle Size

  • react-virtualized:

    react-virtualized is a feature-rich library, which means it comes with a larger bundle size compared to simpler solutions. However, the trade-off is worth it for applications that need advanced virtualization features and customization options.

  • react-list:

    react-list is a lightweight library that adds minimal overhead to your bundle. It is designed to be efficient while providing the necessary features for virtualization and dynamic item rendering.

  • react-tiny-virtual-list:

    react-tiny-virtual-list is designed to be ultra-lightweight, making it an excellent choice for projects where bundle size is a critical concern. Its minimalistic design ensures that you get virtualization without adding unnecessary weight to your application.

  • react-infinite:

    react-infinite has a moderate bundle size, but it is not optimized for virtualization, which means it may not be the best choice for performance-sensitive applications with extremely large lists.

  • react-window:

    react-window is a much smaller and more efficient alternative to react-virtualized, offering similar virtualization capabilities with a significantly reduced bundle size. This makes it ideal for modern applications that prioritize performance and quick load times.

Dynamic Item Heights

  • react-virtualized:

    react-virtualized provides robust support for dynamic item heights, allowing you to create lists and grids where items can have different sizes. It includes components that can handle both fixed and variable heights, making it highly versatile for complex layouts.

  • react-list:

    react-list supports dynamic item heights, allowing it to handle lists where items may have different sizes. This feature makes it more flexible and suitable for a wider range of use cases, including lists with images, text, or other variable content.

  • react-tiny-virtual-list:

    react-tiny-virtual-list supports dynamic item heights, but it requires you to provide a function that calculates the height of each item. This allows it to accurately render items with varying heights while still benefiting from virtualization.

  • react-infinite:

    react-infinite does not handle dynamic item heights natively, as it focuses on infinite scrolling rather than virtualization. This can be a limitation if your list items have varying heights and you need precise rendering.

  • react-window:

    react-window supports dynamic item heights, but like react-tiny-virtual-list, it requires you to provide a way to calculate the height of each item. This feature allows it to efficiently render lists with varying item sizes while keeping the virtualization performance intact.

Ease of Integration: Code Examples

  • react-virtualized:

    react-virtualized may require more time to integrate due to its complexity and the wide range of features it offers. However, it is well-documented, and once you understand its components, it provides great flexibility and performance. Example:

    import React from 'react';
    import { List } from 'react-virtualized';
    
    const MyVirtualizedList = ({ items }) => {
      return (
        <List
          width={300}
          height={400}
          rowCount={items.length}
          rowHeight={50}
          rowRenderer={({ index, style }) => (
            <div style={style}>{items[index]}</div>
          )}
        />
      );
    };
    
  • react-list:

    react-list is easy to integrate into existing projects, especially if you need a quick solution for lists with varying heights. Its API is simple, and it works well with both static and dynamic data. Example:

    import React from 'react';
    import { List } from 'react-list';
    
    const MyList = ({ items }) => {
      return (
        <List
          itemRenderer={(index, key) => <div key={key}>{items[index]}</div>}
          length={items.length}
          type="uniform"
        />
      );
    };
    
  • react-tiny-virtual-list:

    Integrating react-tiny-virtual-list is quick and easy, thanks to its simple API and minimal configuration requirements. It is particularly well-suited for projects that need virtualization without a lot of complexity. Example:

    import React from 'react';
    import { VirtualList } from 'react-tiny-virtual-list';
    
    const MyVirtualList = ({ items }) => {
      return (
        <VirtualList
          width={300}
          height={400}
          itemCount={items.length}
          itemSize={50}
          overscanCount={5}
          itemRenderer={({ index, style }) => (
            <div style={style}>{items[index]}</div>
          )}
        />
      );
    };
    
  • react-infinite:

    Integrating react-infinite is straightforward, especially for simple lists. Its API is easy to understand, and it requires minimal setup to get infinite scrolling working. However, it may require additional work to handle loading states and data fetching. Example:

    import React from 'react';
    import Infinite from 'react-infinite';
    
    const InfiniteList = ({ items, loadMore }) => {
      return (
        <Infinite
          elementHeight={50}
          infiniteLoadBeginEdgeOffset={100}
          onInfiniteLoad={loadMore}
          isInfiniteLoading={false}
        >
          {items.map(item => (
            <div key={item.id}>{item.content}</div>
          ))}
        </Infinite>
      );
    };
    
  • react-window:

    react-window is designed for easy integration, with a straightforward API that makes it simple to implement virtualization in your lists. It is well-suited for developers who want a quick and efficient solution without a steep learning curve. Example:

    import React from 'react';
    import { FixedSizeList } from 'react-window';
    
    const MyWindowedList = ({ items }) => {
      return (
        <FixedSizeList
          height={400}
          itemCount={items.length}
          itemSize={50}
          width={300}
        >
          {({ index, style }) => (
            <div style={style}>{items[index]}</div>
          )}
        </FixedSizeList>
      );
    };
    
How to Choose: react-virtualized vs react-list vs react-tiny-virtual-list vs react-infinite vs react-window
  • react-virtualized:

    Choose react-virtualized if you need a comprehensive solution with a wide range of features for virtualizing lists, tables, and grids. It is highly customizable and suitable for complex applications that require advanced virtualization techniques and support for both fixed and dynamic item sizes.

  • react-list:

    Select react-list if you want a lightweight library that supports both virtualization and dynamic item heights. It is ideal for lists where items may have varying heights, and you need a flexible solution without a lot of overhead.

  • react-tiny-virtual-list:

    Opt for react-tiny-virtual-list if you need a minimalistic and highly performant virtualized list component. It is designed for simplicity and efficiency, making it a great choice for projects where you want to keep the bundle size small while still benefiting from virtualization.

  • react-infinite:

    Choose react-infinite if you need a simple solution for infinite scrolling with support for loading more items as the user scrolls. It is easy to integrate and works well for lists where you can fetch data in chunks.

  • react-window:

    Select react-window if you want a lightweight and modern alternative to react-virtualized with a simpler API. It is designed for performance and ease of use, making it a great choice for projects that need efficient virtualization without the complexity of a larger library.

README for react-virtualized

React virtualized

React components for efficiently rendering large lists and tabular data. Check out the demo for some examples.

If you like this project, 🎉 become a sponsor or ☕ buy me a coffee

Sponsors

The following wonderful companies have sponsored react-virtualized:

Learn more about becoming a sponsor!

A word about react-window

If 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.

Getting started

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.

Dependencies

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.

Pure Components

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.

Pass-thru props

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} />
Public methods

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.

Documentation

API documentation available here.

There are also a couple of how-to guides:

Examples

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:

Supported Browsers

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.

Friends

Here are some great components built on top of react-virtualized:

  • react-infinite-calendar: Infinite scrolling date-picker with localization, themes, keyboard support, and more
  • react-sortable-hoc: Higher-order components to turn any list into an animated, touch-friendly, sortable list
  • react-sortable-tree: Drag-and-drop sortable representation of hierarchical data
  • react-virtualized-checkbox: Checkbox group component with virtualization for large number of options
  • react-virtualized-select: Drop-down menu for React with windowing to support large numbers of options.
  • react-virtualized-tree: A reactive tree component that aims to render large sets of tree structured data in an elegant and performant way
  • react-timeline-9000: A calendar timeline component that is capable of displaying and interacting with a large number of items

Contributions

Use GitHub issues for requests.

I actively welcome pull requests; learn how to contribute.

Changelog

Changes are tracked in the changelog.

License

react-virtualized is available under the MIT License.