FixedSizeList固定尺寸的列表

  1. import { FixedSizeList as List } from 'react-window';
  2. const Row = ({ index, style }) => (
  3. <div style={style}>Row {index}</div>
  4. );
  5. function App() {
  6. return (
  7. <List
  8. height={150}
  9. itemCount={100000}
  10. itemSize={35}
  11. width={300}
  12. >
  13. {Row}
  14. </List>
  15. );
  16. }
  17. export default App;

image.png
image.png

renderProps参数

  • rowIndex

image.png

type=horizontal

  • columnIndex

Grid

  • columnIndex
  • rowIndex

image.png