Careeroza
Using react-window
Library Version
In real projects use a tested library: react-window (small, by the React team member Brian Vaughn), react-virtuoso or TanStack Virtual.
import { FixedSizeList } from 'react-window';
const Row = ({ index, style }) => (
<div style={style}>Row #{index + 1}</div> // style positions the row: always pass it
);
export default function BigList() {
return (
<FixedSizeList height={400} width="100%" itemCount={10000} itemSize={35}>
{Row}
</FixedSizeList>
);
}Note: Rows with different heights: use VariableSizeList; for grids use FixedSizeGrid.