0Pricing
React Academy · Lesson

Combining Virtualization with Data Fetching

Implement infinite scroll by triggering data fetches when the virtualized list reaches its end.

The Infinite Scroll Pattern

Infinite scroll loads more data as the user nears the end of the list, instead of paginating with explicit page buttons. Combined with virtualization, it lets you browse huge datasets fluidly.

The list shows only visible rows while new data is fetched in the background just before the user reaches the bottom.

The onItemsRendered Callback

react-window list components accept an onItemsRendered callback that reports which item indices are currently rendered. It provides visible and overscan start and stop indices.

This callback is your hook into scrolling, letting you detect how far through the list the user has scrolled without wiring up raw scroll events.

All lessons in this course

  1. The Large List Rendering Problem
  2. FixedSizeList: Rendering Thousands of Items
  3. VariableSizeList: Dynamic Row Heights
  4. Combining Virtualization with Data Fetching
← Back to React Academy