react-virtualized vs react-infinite-scroller vs react-window
React Infinite Scrolling Libraries
react-virtualizedreact-infinite-scrollerreact-windowSimilar Packages:

React Infinite Scrolling Libraries

These libraries are designed to efficiently render large lists of data in React applications, enhancing user experience by loading content dynamically as the user scrolls. They help manage performance issues associated with rendering extensive datasets by implementing virtualization techniques, which only render items that are currently visible in the viewport. This approach minimizes the number of DOM nodes created, leading to improved performance and responsiveness in applications that deal with large datasets.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-virtualized1,884,86227,0712.24 MB0a year agoMIT
react-infinite-scroller03,30230.3 kB98-MIT
react-window017,177209 kB13 months agoMIT

Feature Comparison: react-virtualized vs react-infinite-scroller vs react-window

Performance Optimization

  • react-virtualized:

    react-virtualized excels in performance by rendering only the visible items in the list, significantly reducing the number of DOM nodes and improving rendering speed. It supports features like dynamic row heights and cell caching, making it suitable for complex data presentations.

  • react-infinite-scroller:

    react-infinite-scroller optimizes performance by loading additional items only when the user approaches the end of the list, reducing the initial load time and memory usage. However, it does not implement virtualization, which may lead to performance issues with very large datasets.

  • react-window:

    react-window provides efficient rendering by only displaying items that are currently in the viewport, similar to react-virtualized but with a smaller footprint. It is optimized for performance with a simpler API, making it easy to integrate into applications.

Ease of Use

  • react-virtualized:

    react-virtualized has a steeper learning curve due to its extensive feature set and configuration options. While powerful, it may require more time to understand and implement effectively, especially for developers unfamiliar with virtualization concepts.

  • react-infinite-scroller:

    react-infinite-scroller is designed for ease of use, with a simple API that allows developers to quickly implement infinite scrolling without much configuration. It is particularly user-friendly for those new to React or those who require a quick solution.

  • react-window:

    react-window strikes a balance between simplicity and functionality. It offers a straightforward API that is easy to grasp, making it accessible for developers while still providing the essential features needed for efficient list rendering.

Flexibility and Customization

  • react-virtualized:

    react-virtualized provides extensive customization capabilities, allowing developers to create complex layouts and behaviors. Its flexibility makes it suitable for a wide range of applications, from simple lists to intricate data grids.

  • react-infinite-scroller:

    react-infinite-scroller offers limited customization options, focusing primarily on infinite scrolling. It is best suited for applications that require a straightforward implementation without extensive customization needs.

  • react-window:

    react-window offers a good level of customization while maintaining simplicity. It allows developers to adjust item sizes and styles easily, making it adaptable for various use cases without overwhelming complexity.

Community and Support

  • react-virtualized:

    react-virtualized boasts a larger community and extensive documentation, providing ample resources for developers. This support can be invaluable for troubleshooting and finding best practices when implementing complex features.

  • react-infinite-scroller:

    react-infinite-scroller has a smaller community compared to the other two libraries, which may result in fewer resources and examples available for troubleshooting and implementation guidance.

  • react-window:

    react-window, being a more recent library, has a growing community and good documentation. While it may not have as extensive a support network as react-virtualized, it is gaining traction and has sufficient resources for most common use cases.

Use Cases

  • react-virtualized:

    react-virtualized is best suited for applications with complex data presentations, such as dashboards or data tables, where performance and flexibility are crucial due to the large volume of data being displayed.

  • react-infinite-scroller:

    react-infinite-scroller is ideal for applications that require simple infinite scrolling, such as social media feeds or image galleries, where loading more items as the user scrolls is the primary requirement.

  • react-window:

    react-window is perfect for straightforward lists and grids where performance is essential, but the complexity of features is not required. It works well for applications that prioritize speed and simplicity.

How to Choose: react-virtualized vs react-infinite-scroller vs react-window

  • react-virtualized:

    Opt for react-virtualized if you require advanced features such as windowing, dynamic row heights, and complex grid layouts. It provides a comprehensive set of components for efficiently rendering large lists and tables, making it suitable for applications with complex data structures.

  • react-infinite-scroller:

    Choose react-infinite-scroller if you need a simple and straightforward solution for implementing infinite scrolling in your application. It is easy to set up and works well for lists where you want to load more items as the user scrolls down.

  • react-window:

    Select react-window for a lightweight alternative to react-virtualized, focusing on simplicity and performance. It is ideal for applications that need basic virtualization without the overhead of additional features, making it a great choice for straightforward lists.

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.