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
- The Large List Rendering Problem
- FixedSizeList: Rendering Thousands of Items
- VariableSizeList: Dynamic Row Heights
- Combining Virtualization with Data Fetching