import { useRef } from 'react'; import { VariableSizeList as List, areEqual } from 'react-window'; import InfiniteLoader from 'react-window-infinite-loader'; const Demo = () => { const listRef = useRef(); const click = () => { if (listRef.current) { listRef.current.scrollToItem(0); } }; return ( click ); }; const ListWrap = ({ hasNextPage, isNextPageLoading, loadNextPage, listRef }) => { return ( {({ onItemsRendered, ref }) => { return ( { ref(instance); listRef.current = instance; }} > {Cell} ); }} ); };