react-window vs react-virtualized vs react-infinite-scroll-component vs react-infinite-scroller vs vue-virtual-scroller vs ngx-infinite-scroll vs vue-infinite-loading
無限スクロール
react-windowreact-virtualizedreact-infinite-scroll-componentreact-infinite-scrollervue-virtual-scrollerngx-infinite-scrollvue-infinite-loading類似パッケージ:
無限スクロール

無限スクロールは、ユーザーがページをスクロールする際にコンテンツが自動的に追加されるインターフェースパターンです。これにより、ユーザーはページを手動で切り替えることなく、シームレスにコンテンツを閲覧できます。無限スクロールは、ソーシャルメディアフィード、画像ギャラリー、ニュースサイトなど、さまざまなアプリケーションで使用されており、ユーザーエンゲージメントを向上させる効果があります。

npmのダウンロードトレンド
3 年
GitHub Starsランキング
統計詳細
パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
react-window4,131,52716,991206 kB11ヶ月前MIT
react-virtualized1,405,67527,0392.24 MB11年前MIT
react-infinite-scroll-component937,8643,048169 kB1984日前MIT
react-infinite-scroller454,4613,30730.3 kB98-MIT
vue-virtual-scroller345,17110,527406 kB247-MIT
ngx-infinite-scroll314,5301,25770.3 kB151日前MIT
vue-infinite-loading72,5402,662-786年前MIT
機能比較: react-window vs react-virtualized vs react-infinite-scroll-component vs react-infinite-scroller vs vue-virtual-scroller vs ngx-infinite-scroll vs vue-infinite-loading

フレームワーク

  • react-window:

    React専用

  • react-virtualized:

    React専用

  • react-infinite-scroll-component:

    React専用

  • react-infinite-scroller:

    React専用

  • vue-virtual-scroller:

    Vue.js専用

  • ngx-infinite-scroll:

    Angular専用

  • vue-infinite-loading:

    Vue.js専用

無限スクロール機能

  • react-window:

    仮想化されたリストで無限スクロールをサポート

  • react-virtualized:

    無限スクロールと仮想化を組み合わせて効率的に表示

  • react-infinite-scroll-component:

    スクロール位置に応じてコンテンツを追加

  • react-infinite-scroller:

    スクロールイベントに基づいてコンテンツをロード

  • vue-virtual-scroller:

    仮想化されたリストで無限スクロールを実現

  • ngx-infinite-scroll:

    スクロール位置に基づいて自動的にコンテンツをロード

  • vue-infinite-loading:

    スクロールに応じてコンテンツを追加

仮想化

  • react-window:

    軽量な仮想化リストとグリッドを提供

  • react-virtualized:

    仮想化リスト、グリッド、セルを提供

  • react-infinite-scroll-component:

    仮想化はサポートしていない

  • react-infinite-scroller:

    仮想化はサポートしていない

  • vue-virtual-scroller:

    仮想化リストを提供し、パフォーマンスを向上

  • ngx-infinite-scroll:

    仮想化はサポートしていない

  • vue-infinite-loading:

    仮想化はサポートしていない

カスタマイズ性

  • react-window:

    シンプルでカスタマイズしやすい

  • react-virtualized:

    高度なカスタマイズが可能だが、設定が複雑

  • react-infinite-scroll-component:

    カスタマイズが容易で、プロップスを通じて設定可能

  • react-infinite-scroller:

    シンプルなAPIでカスタマイズ可能

  • vue-virtual-scroller:

    仮想化に関するカスタマイズが可能

  • ngx-infinite-scroll:

    カスタマイズ可能だが、Angularに依存

  • vue-infinite-loading:

    カスタマイズ可能なローディングインジケーターを提供

コード例

  • react-window:

    Reactでの仮想化リストの例

    import { FixedSizeList as List } from 'react-window';
    
    const Example = () => {
      return (
        <List
          height={300}
          itemCount={items.length}
          itemSize={35}
          width={300}
        >
          {({ index }) => <div>{items[index]}</div>}
        </List>
      );
    };
    
  • react-virtualized:

    Reactでの仮想化リストと無限スクロールの例

    import { List } from 'react-virtualized';
    
    const Example = () => {
      return (
        <List
          height={300}
          width={300}
          rowCount={items.length}
          rowHeight={50}
          rowRenderer={({ index }) => <div>{items[index]}</div>}
        />
      );
    };
    
  • react-infinite-scroll-component:

    Reactでの無限スクロールの例

    import InfiniteScroll from 'react-infinite-scroll-component';
    
    const Example = () => {
      return (
        <InfiniteScroll
          dataLength={items.length}
          next={fetchData}
          hasMore={hasMore}
          loader={<h4>Loading...</h4>}
        >
          {items.map((item, index) => (
            <div key={index}>{item}</div>
          ))}
        </InfiniteScroll>
      );
    };
    
  • react-infinite-scroller:

    Reactでの無限スクロールの例

    import InfiniteScroller from 'react-infinite-scroller';
    
    const Example = () => {
      return (
        <InfiniteScroller
          pageStart={0}
          loadMore={loadMore}
          hasMore={hasMore}
        >
          {items.map((item, index) => (
            <div key={index}>{item}</div>
          ))}
        </InfiniteScroller>
      );
    };
    
  • vue-virtual-scroller:

    Vue.jsでの仮想スクロールの例

    <template>
      <virtual-scroller :items="items" :item-height="50">
        <template v-slot:default="{ item }">
          <div>{{ item.name }}</div>
        </template>
      </virtual-scroller>
    </template>
    
  • ngx-infinite-scroll:

    Angularでの無限スクロールの例

    <div *ngFor="let item of items" class="item">{{ item }}</div>
    <div
      infiniteScroll
      [infiniteScrollDistance]="scrollDistance"
      [infiniteScrollUpDistance]="scrollUpDistance"
      [infiniteScrollFromTop]="scrollFromTop"
      (infiniteScroll)="loadData()"
    ></div>
    
  • vue-infinite-loading:

    Vue.jsでの無限スクロールの例

    <template>
      <div>
        <div v-for="item in items" :key="item.id">{{ item.name }}</div>
        <infinite-loading
          @infinite="loadMore"
          :spinner="'bubbles'"
          :finished="!hasMore"
        ></infinite-loading>
      </div>
    </template>
    
選び方: react-window vs react-virtualized vs react-infinite-scroll-component vs react-infinite-scroller vs vue-virtual-scroller vs ngx-infinite-scroll vs vue-infinite-loading
  • react-window:

    react-windowは、react-virtualizedの軽量版で、仮想化されたリストやグリッドを提供します。無限スクロールと組み合わせて使用することで、メモリ使用量を削減し、パフォーマンスを向上させることができます。

  • react-virtualized:

    react-virtualizedは、大量のデータを効率的に表示するための仮想化コンポーネントを提供します。無限スクロール機能も含まれており、パフォーマンスを最適化しながら大量のアイテムを表示する必要があるアプリケーションに最適です。

  • react-infinite-scroll-component:

    react-infinite-scroll-componentは、Reactアプリケーション向けのシンプルで使いやすい無限スクロールコンポーネントです。カスタマイズが容易で、軽量なため、パフォーマンスを重視するプロジェクトに適しています。

  • react-infinite-scroller:

    react-infinite-scrollerは、Reactアプリケーション向けの無限スクロールライブラリで、スクロール位置に基づいてコンテンツを自動的にロードします。シンプルなAPIを提供し、迅速な実装が可能です。

  • vue-virtual-scroller:

    vue-virtual-scrollerは、Vue.jsアプリケーション向けの仮想スクロールコンポーネントです。大量のデータを効率的に表示するためのもので、無限スクロールと組み合わせて使用することで、パフォーマンスを大幅に向上させることができます。

  • ngx-infinite-scroll:

    ngx-infinite-scrollは、Angularアプリケーション向けの無限スクロールソリューションです。Angularフレームワークを使用している場合、ngx-infinite-scrollは簡単に統合でき、Angularのライフサイクルに適した方法で動作します。

  • vue-infinite-loading:

    vue-infinite-loadingは、Vue.jsアプリケーション向けの無限スクロールコンポーネントです。シンプルなAPIとカスタマイズ可能なローディングインジケーターを提供し、Vueプロジェクトに簡単に統合できます。

react-window のREADME

react-window

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.

Support

If you like this project there are several ways to support it:

The following wonderful companies and individuals have sponsored react-window:

Installation

Begin by installing the library from NPM:

npm install react-window

TypeScript types

TypeScript definitions are included within the published dist folder

Documentation

Documentation for this project is available at react-window.vercel.app; version 1.x documentation can be found at react-window-v1.vercel.app.

List

Required props

NameDescription
rowComponent

React component responsible for rendering a row.

This component will receive an index and style prop by default. Additionally it will receive prop values passed to rowProps.

ℹ️ The prop types for this component are exported as RowComponentProps

rowCount

Number of items to be rendered in the list.

rowHeight

Row height; the following formats are supported:

  • number of pixels (number)
  • percentage of the grid's current height (string)
  • function that returns the row height (in pixels) given an index and cellProps
  • dynamic row height cache returned by the useDynamicRowHeight hook

⚠️ 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 ariaAttributes, index, or style props.

Optional props

NameDescription
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 useListRef and useListCallbackRef hooks are exported for convenience use in TypeScript projects.

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.

Grid

Required props

NameDescription
cellComponent

React component responsible for rendering a cell.

This component will receive an index and style prop by default. Additionally it will receive prop values passed to cellProps.

ℹ️ The prop types for this component are exported as CellComponentProps

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 ariaAttributes, columnIndex, rowIndex, or style props.

columnCount

Number of columns to be rendered in the grid.

columnWidth

Column width; the following formats are supported:

  • number of pixels (number)
  • percentage of the grid's current width (string)
  • function that returns the row width (in pixels) given an index and cellProps
rowCount

Number of rows to be rendered in the grid.

rowHeight

Row height; the following formats are supported:

  • number of pixels (number)
  • percentage of the grid's current height (string)
  • function that returns the row height (in pixels) given an index and cellProps

Optional props

NameDescription
className

CSS class name.

dir

Corresponds to the HTML dir attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir

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

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 useGridRef and useGridCallbackRef hooks are exported for convenience use in TypeScript projects.

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.