API Reference
React
Grid

Grid

This component renders the grid.

import * as React from 'react';
import { Grid, useGrid } from '@virtual-grid/react';
 
const Page = () => {
  const ref = React.useRef<HTMLDivElement>(null);
 
  const grid = useGrid({
    scrollRef: ref,
    count: 1000,
    size: 120
    // ...
  });
 
  return (
    <div ref={ref} style={{ height: '400px', overflow: 'auto' }}>
      <Grid grid={grid}>{(i) => <div key={i}>...</div>}</Grid>
    </div>
  );
};
OptionTypeRequiredDescription
gridGridPropsYesReturned value by the useGrid (opens in a new tab) hook