@helix-x/datagrid-ui - v0.1.2
    Preparing search index...

    Function useVirtualRows

    • Fixed-height row windowing.

      Parameters

      Returns UseVirtualRowsResult

      The visible window plus the handlers that maintain it.

      Fixed heights are a deliberate constraint: they make the visible range O(1) to compute and remove the measure-then-reflow pass that variable heights force. Scroll position is tracked in a ref and only promoted to state when the computed window actually changes, so scrolling within a single row re-renders nothing.

      const { window, totalHeight, onScroll, setViewportHeight } = useVirtualRows({
      rowCount: rows.length,
      rowHeight: 36,
      });

      <div onScroll={onScroll} style={{ overflow: 'auto' }}>
      <div style={{ height: totalHeight }}>
      {rows.slice(window.startIndex, window.endIndex).map(renderRow)}
      </div>
      </div>