react-window vs react-virtualized vs react-infinite-scroll-component vs react-tiny-virtual-list
無限スクロールと仮想リストライブラリ
react-windowreact-virtualizedreact-infinite-scroll-componentreact-tiny-virtual-list類似パッケージ:
無限スクロールと仮想リストライブラリ

無限スクロールと仮想リストライブラリは、パフォーマンスを向上させるために大量のデータを効率的に表示するために使用されます。これらのライブラリは、ユーザーがスクロールする際に必要なデータのみをレンダリングし、メモリ使用量を削減し、スムーズなユーザー体験を提供します。特に、長いリストや大量のデータを扱うアプリケーションでの使用が推奨されます。

npmのダウンロードトレンド
3 年
GitHub Starsランキング
統計詳細
パッケージ
ダウンロード数
Stars
サイズ
Issues
公開日時
ライセンス
react-window4,044,35216,987206 kB11ヶ月前MIT
react-virtualized1,380,15427,0352.24 MB11年前MIT
react-infinite-scroll-component898,9863,046169 kB1982日前MIT
react-tiny-virtual-list100,0232,495-547年前MIT
機能比較: react-window vs react-virtualized vs react-infinite-scroll-component vs react-tiny-virtual-list

パフォーマンス最適化

  • react-window:

    軽量で、シンプルな仮想化を提供します。必要なアイテムのみをレンダリングするため、パフォーマンスが向上し、特に大規模なリストに適しています。

  • react-virtualized:

    非常に多機能で、リストやテーブルの仮想化を行う際に高いパフォーマンスを発揮します。大量のデータを扱う場合でも、効率的にレンダリングを行い、スムーズなユーザー体験を提供します。

  • react-infinite-scroll-component:

    このライブラリは、スクロール位置に基づいてデータを動的にロードすることで、パフォーマンスを最適化します。ユーザーがスクロールするたびに新しいデータを取得し、表示するため、初期ロード時間を短縮できます。

  • react-tiny-virtual-list:

    小規模なリストに最適化されており、必要なアイテムのみをレンダリングすることで、メモリ使用量を削減します。シンプルな実装で、パフォーマンスを向上させることができます。

使いやすさ

  • react-window:

    シンプルな設計で、使いやすさを重視しています。設定が簡単で、すぐに仮想化を実装できます。

  • react-virtualized:

    多機能であるため、使いこなすには時間がかかるかもしれませんが、柔軟性が高く、複雑な要件に対応できます。

  • react-infinite-scroll-component:

    簡単に無限スクロールを実装できるため、初心者でも扱いやすいです。設定が少なく、すぐにプロジェクトに組み込むことができます。

  • react-tiny-virtual-list:

    シンプルなAPIを持ち、学習コストが低いため、すぐに使い始めることができます。小規模なプロジェクトに最適です。

機能性

  • react-window:

    仮想化されたリストを簡単に作成できる軽量なライブラリで、特にパフォーマンスを重視しています。

  • react-virtualized:

    リスト、テーブル、グリッドなど、さまざまなデータ表示に対応する多機能なライブラリです。

  • react-infinite-scroll-component:

    無限スクロールの機能を提供し、ページネーションを必要としないデータの表示が可能です。スクロールに応じてデータを自動的にロードします。

  • react-tiny-virtual-list:

    基本的な仮想リスト機能を提供し、簡単なリスト表示に適しています。

カスタマイズ性

  • react-window:

    カスタマイズが容易で、特定のニーズに合わせて簡単に調整できます。

  • react-virtualized:

    非常に高いカスタマイズ性を持ち、さまざまなデータ表示の要件に応じて調整できます。

  • react-infinite-scroll-component:

    無限スクロールの動作をカスタマイズするオプションがあり、特定の要件に合わせて調整可能です。

  • react-tiny-virtual-list:

    シンプルな設計のため、カスタマイズは限られていますが、基本的なニーズには十分です。

メンテナンス性

  • react-window:

    シンプルな設計で、メンテナンスが容易です。

  • react-virtualized:

    多機能であるため、メンテナンスには注意が必要ですが、豊富なドキュメントがサポートしています。

  • react-infinite-scroll-component:

    シンプルな実装のため、メンテナンスが容易です。

  • react-tiny-virtual-list:

    軽量でシンプルなため、メンテナンスが容易です。

選び方: react-window vs react-virtualized vs react-infinite-scroll-component vs react-tiny-virtual-list
  • react-window:

    軽量でシンプルな仮想化が必要な場合に選択してください。特に、パフォーマンスを重視しつつ、簡単に実装したい場合に適しています。

  • react-virtualized:

    高度な機能やカスタマイズが必要な場合に選択してください。多機能で、複雑なリストやテーブルの表示に適しており、パフォーマンスを最大化するための多くのオプションを提供します。

  • react-infinite-scroll-component:

    無限スクロールの実装が簡単で、スクロールに応じてデータを自動的にロードしたい場合に選択してください。特に、ページネーションが不要な場合に適しています。

  • react-tiny-virtual-list:

    小規模なリストや簡単な仮想化が必要な場合に選択してください。軽量で、シンプルなAPIを持っているため、学習コストが低く、すぐに使い始めることができます。

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.