import * as React from 'react'; import InfiniteLoader from 'react-window-infinite-loader'; import { FixedSizeList } from 'react-window'; const LOADING = 1; const LOADED = 2; const itemStatusMap: { [key: number]: number } = {}; const isItemLoaded = (index: number) => !!itemStatusMap[index]; const loadMoreItems = (startIndex: number, stopIndex: number) => { for (let index = startIndex; index <= stopIndex; index++) { itemStatusMap[index] = LOADING; } return new Promise(resolve => setTimeout(() => { for (let index = startIndex; index <= stopIndex; index++) { itemStatusMap[index] = LOADED; } resolve(); }, 2500) ); }; class Row extends React.PureComponent<{ index: number; style: React.CSSProperties; data: any }> { render() { const { index, style } = this.props; return (
{`${itemStatusMap[index] === LOADED ? `Row ${index}` : 'Loading...'}`}
); } } const App = () => (

This demo app mimics loading remote data with a 2.5s timer. While rows are "loading" they will display a "Loading..." label. Once data has been "loaded" the row number will be displayed. Start scrolling the list to automatically load data.

{({ onItemsRendered, ref }) => ( {Row} )}

Check out the documentation to learn more:
github.com/bvaughn/react-window-infinite-loader

);