共1个回答
UJ
游客uJLTPs

你可以使用https://npmjs.com/package/react-window-infinite-loader来实现:


import { FixedSizeList as List } from "react-window"; import InfiniteLoader from "react-window-infinite-loader"; <InfiniteLoader isItemLoaded={isItemLoaded} itemCount={1000} loadMoreItems={loadMoreItems} > {({ onItemsRendered, ref }) => ( <List className="List" height={150} itemCount={1000} itemSize={30} onItemsRendered={onItemsRendered} ref={ref} width={300} > {Row} </List> )} </InfiniteLoader>

demo:https://codesandbox.io/s/5wqo7z2np4

回答问题