react-virtualized vs ngx-infinite-scroll vs react-infinite-scroll-component vs react-infinite-scroller vs react-window vs vue-infinite-loading vs vue-virtual-scroller
Infinite Scrolling and Virtualized List Libraries for Modern Web Applications
react-virtualizedngx-infinite-scrollreact-infinite-scroll-componentreact-infinite-scrollerreact-windowvue-infinite-loadingvue-virtual-scroller类似的npm包:

Infinite Scrolling and Virtualized List Libraries for Modern Web Applications

The listed packages provide solutions for efficiently rendering large datasets in web applications by either loading content incrementally as the user scrolls (infinite scroll) or by only rendering visible items to reduce memory and performance overhead (virtualization). These libraries are framework-specific: ngx-infinite-scroll targets Angular, react-infinite-scroll-component, react-infinite-scroller, react-virtualized, and react-window serve React, while vue-infinite-loading and vue-virtual-scroller are built for Vue. Infinite scroll libraries typically trigger data fetching when the user nears the bottom of a container, whereas virtualized list libraries optimize rendering by recycling DOM elements for off-screen items.

npm下载趋势

3 年

GitHub Stars 排名

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
react-virtualized1,358,52527,0832.24 MB11 年前MIT
ngx-infinite-scroll293,5721,25470.3 kB153 个月前MIT
react-infinite-scroll-component03,068169 kB2013 个月前MIT
react-infinite-scroller03,30730.3 kB98-MIT
react-window017,128209 kB11 个月前MIT
vue-infinite-loading02,657-776 年前MIT
vue-virtual-scroller010,632166 kB2514 天前MIT

Infinite Scroll vs Virtualized Lists: A Practical Guide for Angular, React, and Vue

When dealing with large datasets in web apps, two common strategies emerge: infinite scroll (load more data as the user scrolls) and virtualization (render only what’s visible). The right choice depends on your framework, data size, and performance needs. Let’s compare the leading libraries across Angular, React, and Vue.

🔄 Core Patterns: When to Load vs When to Render

Infinite Scroll Libraries

These trigger a callback (e.g., fetch next page) when the user scrolls near the bottom. They do not limit DOM size—every loaded item stays in the DOM. Suitable for moderate data volumes or when full DOM access is needed (e.g., for search).

  • Angular: ngx-infinite-scroll
  • React: react-infinite-scroll-component (active), react-infinite-scroller (deprecated)
  • Vue: vue-infinite-loading

Virtualized List Libraries

These render only visible items, recycling DOM nodes as the user scrolls. Essential for very large datasets (10k+ items) to avoid memory and performance issues.

  • React: react-window, react-virtualized
  • Vue: vue-virtual-scroller

⚠️ Critical Note: react-infinite-scroller is deprecated. Its npm page states: "This package has been deprecated. Please use react-infinite-scroll-component instead." Do not use it in new projects.

🧩 Framework-Specific Implementations

Angular: ngx-infinite-scroll

Attach as a directive to a scrollable container. Triggers (scrolled) when nearing the bottom.

<!-- Angular template -->
<div class="container"
     infiniteScroll
     [infiniteScrollDistance]="2"
     [infiniteScrollThrottle]="50"
     (scrolled)="onScroll()">
  <div *ngFor="let item of items">{{ item }}</div>
</div>
// Component
onScroll() {
  this.loadMoreData();
}

No virtualization—each new item adds to the DOM. Best for feeds with <1000 items.

React: Infinite Scroll Options

react-infinite-scroll-component (Recommended)

Wraps your list and shows a loader while fetching.

import InfiniteScroll from 'react-infinite-scroll-component';

function MyList() {
  return (
    <InfiniteScroll
      dataLength={items.length}
      next={fetchMoreData}
      hasMore={hasMore}
      loader={<h4>Loading...</h4>}
    >
      {items.map(item => <div key={item.id}>{item.name}</div>)}
    </InfiniteScroll>
  );
}

Simple and effective—but again, all items stay in the DOM.

react-infinite-scroller (Deprecated)

Avoid. Example shown only for legacy reference:

// DO NOT USE IN NEW PROJECTS
import InfiniteScroller from 'react-infinite-scroller';

<InfiniteScroller loadMore={loadFunc} hasMore={more}>
  {items}
</InfiniteScroller>

React: Virtualized Lists

react-window (Lightweight & Fast)

Ideal for basic lists/grids. Uses FixedSizeList or VariableSizeList.

import { FixedSizeList as List } from 'react-window';

const Row = ({ index, style }) => (
  <div style={style}>Row {index}</div>
);

<List
  height={600}
  itemCount={1000}
  itemSize={35}
  width="100%"
>
  {Row}
</List>

Minimal API, excellent performance, small bundle.

react-virtualized (Feature-Rich)

Supports advanced layouts like Grid, Table, and Masonry.

import { List } from 'react-virtualized';

<List
  width={800}
  height={600}
  rowCount={list.length}
  rowHeight={50}
  rowRenderer={({ index, key, style }) => (
    <div key={key} style={style}>{list[index]}</div>
  )}
/>

Use only if you need dynamic measurements or complex layouts not covered by react-window.

Vue: Infinite Scroll

vue-infinite-loading

Component-based with clear loading states.

<template>
  <div>
    <div v-for="item in items" :key="item.id">{{ item.name }}</div>
    <infinite-loading @infinite="infiniteHandler" />
  </div>
</template>

<script>
export default {
  methods: {
    infiniteHandler($state) {
      fetchData().then(data => {
        if (data.length) {
          this.items.push(...data);
          $state.loaded();
        } else {
          $state.complete();
        }
      });
    }
  }
};
</script>

Clean integration with Vue’s reactivity. No virtualization.

Vue: Virtual Scrolling

vue-virtual-scroller

Renders only visible items with smooth scrolling.

<template>
  <RecycleScroller
    class="scroller"
    :items="items"
    :item-size="40"
    key-field="id"
    v-slot="{ item }"
  >
    <div>{{ item.name }}</div>
  </RecycleScroller>
</template>

<script>
import { RecycleScroller } from 'vue-virtual-scroller';
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';

export default {
  components: { RecycleScroller },
  data() {
    return { items: [...] };
  }
};
</script>

Essential for long lists in Vue where performance matters.

⚖️ Trade-offs: Infinite Scroll vs Virtualization

ConcernInfinite Scroll LibrariesVirtualized Libraries
DOM SizeGrows indefinitelyConstant (only visible items)
Memory UsageIncreases with loaded dataStable
Search/FilterEasy (all items in DOM)Requires custom logic (items not in DOM)
Complex LayoutsFull CSS controlLimited to list/grid; harder for masonry
Best ForFeeds, timelines, moderate datasets (<1k)Chat logs, analytics, huge datasets (10k+)

🛠️ Migration Paths

  • From react-infinite-scroller: Replace with react-infinite-scroll-component for same behavior, or switch to react-window if performance becomes an issue.
  • From infinite scroll to virtualization: Only do this if profiling shows jank or memory bloat. Virtualization adds complexity—you lose direct DOM access to off-screen items.

💡 Final Recommendations

  • Angular: Use ngx-infinite-scroll for simple cases; consider custom virtualization or third-party libs like @angular/cdk for large lists.
  • React: Start with react-infinite-scroll-component for simplicity. Switch to react-window when performance degrades. Use react-virtualized only for advanced layouts.
  • Vue: Use vue-infinite-loading for paginated feeds. Use vue-virtual-scroller when you have thousands of items or notice slowdowns.

Remember: Infinite scroll ≠ virtualization. Choose based on whether your bottleneck is network/data loading (infinite scroll) or DOM/rendering performance (virtualization).

如何选择: react-virtualized vs ngx-infinite-scroll vs react-infinite-scroll-component vs react-infinite-scroller vs react-window vs vue-infinite-loading vs vue-virtual-scroller

  • react-virtualized:

    Choose react-virtualized when you need robust virtualization for complex layouts in React, including lists, grids, tables, and masonry. It offers extensive customization for item sizing, scrolling, and performance tuning but comes with a steeper learning curve and larger API surface. Prefer it over react-window only if you require features like dynamic row heights with measurement caching or advanced grid layouts.

  • ngx-infinite-scroll:

    Choose ngx-infinite-scroll if you're working in an Angular application and need a straightforward directive-based solution for triggering load-more callbacks during scrolling. It integrates cleanly with Angular's change detection and supports both window and container-based scrolling. Avoid it if you need advanced layout support like grids or variable-height items without additional custom logic.

  • react-infinite-scroll-component:

    Choose react-infinite-scroll-component for simple infinite scroll behavior in React apps where you want a minimal, component-based API that wraps your list and calls a function when more data is needed. It handles scroll detection and loader display out of the box but does not perform virtualization, so it’s best suited for moderate-sized lists where performance isn’t critically impacted by DOM size.

  • react-infinite-scroller:

    Avoid react-infinite-scroller in new projects—it is deprecated and no longer maintained. The package page on npm explicitly states it has been superseded by other solutions. If encountered in legacy code, plan a migration to react-infinite-scroll-component or a virtualized alternative depending on use case.

  • react-window:

    Choose react-window for high-performance virtualized lists or grids in React when you prioritize simplicity and speed. It’s a lighter, faster successor to react-virtualized with a smaller API focused on fixed or variable-size lists and grids. Use it when you don’t need the extra features of react-virtualized and want minimal bundle impact with excellent runtime performance.

  • vue-infinite-loading:

    Choose vue-infinite-loading if you’re building a Vue 2 or Vue 3 app and need a clean, directive-like component for infinite scroll that shows loading states and triggers data fetches. It works well with server-paginated APIs and integrates smoothly with Vue’s reactivity system. It does not virtualize content, so pair it with manual DOM cleanup or use only when total rendered items remain manageable.

  • vue-virtual-scroller:

    Choose vue-virtual-scroller when you need true virtual scrolling in Vue applications—rendering only visible items to maintain performance with thousands of records. It supports dynamic heights, recycling, and smooth scrolling out of the box. Ideal for chat logs, feeds, or any long list where DOM bloat would otherwise degrade performance.

react-virtualized的README

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.