react-virtualized vs react-infinite vs react-infinite-scroll-component vs react-window
무한 스크롤 라이브러리
react-virtualizedreact-infinitereact-infinite-scroll-componentreact-windowÄhnliche Pakete:

무한 스크롤 라이브러리

무한 스크롤 라이브러리는 대량의 데이터를 효율적으로 표시하기 위해 사용됩니다. 이러한 라이브러리는 사용자가 스크롤을 내릴 때 추가 데이터를 자동으로 로드하여 사용자 경험을 향상시키고, 페이지 로딩 시간을 줄이며, 성능을 최적화합니다. 각 라이브러리는 고유한 기능과 설계 원칙을 가지고 있어 다양한 사용 사례에 적합합니다.

npm-Download-Trend

3 Jahre

GitHub Stars Ranking

Statistik-Detail

Paket
Downloads
Stars
Größe
Issues
Veröffentlichung
Lizenz
react-virtualized1,723,75827,0671.31 MB1vor 8 TagenMIT
react-infinite14,9762,682243 kB101-BSD-3-Clause
react-infinite-scroll-component03,091217 kB138vor 5 MonatenMIT
react-window017,200417 kB0vor 3 MinutenMIT

Funktionsvergleich: react-virtualized vs react-infinite vs react-infinite-scroll-component vs react-window

성능 최적화

  • react-virtualized:

    react-virtualized는 가상화 기술을 사용하여 화면에 보이는 데이터만 렌더링하므로, 대량의 데이터 처리 시 성능이 뛰어납니다. 스크롤 성능이 매우 우수합니다.

  • react-infinite:

    react-infinite는 기본적인 무한 스크롤 기능을 제공하며, 데이터 로딩 시 성능 최적화에 중점을 두고 있습니다. 그러나 대량의 데이터 처리에는 한계가 있을 수 있습니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 다양한 이벤트를 처리할 수 있어 성능 최적화가 뛰어나며, 스크롤 위치에 따라 데이터를 효율적으로 로드합니다.

  • react-window:

    react-window는 react-virtualized보다 가벼운 대안으로, 가상화 기능을 제공하여 성능을 최적화합니다. 적은 메모리 사용으로 빠른 렌더링이 가능합니다.

사용 용이성

  • react-virtualized:

    react-virtualized는 다양한 기능을 제공하지만, 설정이 복잡할 수 있어 학습 곡선이 있습니다.

  • react-infinite:

    react-infinite는 간단한 API를 제공하여 사용하기 쉽고, 빠르게 구현할 수 있습니다. 초보자에게 적합합니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 다양한 옵션과 이벤트를 제공하여 유연성이 높지만, 다소 복잡할 수 있습니다.

  • react-window:

    react-window는 간단한 API를 제공하여 사용이 용이하며, 가벼운 구현이 가능합니다.

기능

  • react-virtualized:

    react-virtualized는 리스트, 테이블, 그리드 등 다양한 형태의 데이터 표시를 지원하며, 고급 기능이 포함되어 있습니다.

  • react-infinite:

    react-infinite는 기본적인 무한 스크롤 기능을 제공하며, 간단한 데이터 로딩을 지원합니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 다양한 이벤트와 옵션을 지원하여 복잡한 무한 스크롤을 구현할 수 있습니다.

  • react-window:

    react-window는 리스트와 그리드 형태의 가상화를 지원하며, 간단한 데이터 표시를 위한 기능을 제공합니다.

유연성

  • react-virtualized:

    react-virtualized는 다양한 데이터 구조를 지원하여 복잡한 데이터 표시 요구 사항에 적합합니다.

  • react-infinite:

    react-infinite는 커스터마이징이 용이하여 기본적인 무한 스크롤을 필요로 하는 프로젝트에 적합합니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 다양한 옵션을 제공하여 복잡한 요구 사항을 충족할 수 있는 유연성을 가지고 있습니다.

  • react-window:

    react-window는 기본적인 가상화 기능을 제공하여 간단한 요구 사항에 적합합니다.

커뮤니티 지원

  • react-virtualized:

    react-virtualized는 큰 커뮤니티와 풍부한 문서가 제공되어 많은 지원을 받을 수 있습니다.

  • react-infinite:

    react-infinite는 비교적 작은 커뮤니티를 가지고 있지만, 기본적인 사용에 대한 문서화가 잘 되어 있습니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 활발한 커뮤니티와 다양한 예제 및 문서가 있어 지원이 좋습니다.

  • react-window:

    react-window는 비교적 새로운 라이브러리지만, 커뮤니티의 지원이 점차 증가하고 있습니다.

Wie man wählt: react-virtualized vs react-infinite vs react-infinite-scroll-component vs react-window

  • react-virtualized:

    react-virtualized는 대량의 데이터 리스트를 처리해야 할 때 선택하세요. 이 라이브러리는 가상화 기능을 통해 성능을 극대화하며, 스크롤 성능이 중요한 경우에 적합합니다.

  • react-infinite:

    react-infinite는 간단한 무한 스크롤 구현을 원할 때 선택하세요. 이 라이브러리는 기본적인 기능을 제공하며, 커스터마이징이 용이합니다.

  • react-infinite-scroll-component:

    react-infinite-scroll-component는 더 많은 기능과 유연성을 제공하므로, 복잡한 무한 스크롤이 필요한 경우 선택하세요. 이 라이브러리는 다양한 이벤트와 옵션을 지원합니다.

  • react-window:

    react-window는 react-virtualized보다 가볍고 간단한 대안으로, 기본적인 가상화 기능을 제공하며, 성능이 중요한 경우에 선택하세요.

README für react-virtualized

React virtualized

React components for efficiently rendering large lists and tabular data. Check out the documentation for live 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.

Getting started

Install react-virtualized using npm.

npm install react-virtualized --save

ES module and CommonJS builds are included, along with TypeScript type definitions. 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';

The package is marked as side-effect free (other than its CSS), so bundlers will tree-shake any components you don't use.

TypeScript types are exported for each component's props (e.g. ListProps, GridProps, TableProps) along with the parameters passed to renderers (e.g. RowRendererParams, CellRendererParams, TableCellProps).

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 are wrapped in memo 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

This shallow comparison will detect changes to any props, even ones a component doesn't use. 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 components can be forcefully re-rendered by calling forceUpdate on their ref. 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

Documentation and live examples for every component are available at react-virtualized-docs.vercel.app.

Components:

CellMeasurer measures cells whose sizes aren't known ahead of time.

Grid, List, Masonry and Table can also be scrolled by the window (or another scrollable element) with the scrollElement prop.

Higher-order components:

[!NOTE] AutoSizer is no longer part of react-virtualized (as of version 10); it is available as the separate react-virtualized-auto-sizer package. See sizing components for how to use it with react-virtualized.

There are also a couple of how-to guides:

Examples

Here are some "recipe" type demos:

Supported Browsers

react-virtualized aims to support all evergreen browsers and recent mobile browsers for iOS and Android.

If you find a browser-specific problem, please report it along with a repro case (e.g. a CodeSandbox).

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.