Render 10,000 rows smoothly with windowing, then add sorting, a sticky header, keyboard navigation, and selection, with logic split into testable modules.
What you'll build
A data grid that scrolls 10k rows smoothly, sorts by column, and supports keyboard selection.
Admin tools, analytics products, and CRMs all eventually need a table with thousands of rows. Rendering 10,000 rows × 4 cells creates 40,000+ DOM nodes. Initial render takes seconds, scrolling janks, and memory climbs.
You'll build a virtualized data grid, organized so logic and view stay separate:
1data.js 10,000 generated rows + layout constants
2virtual.js pure windowing math: which rows are visible?
3sortRows.js pure sorting helpers
4useGridKeyboard.js keyboard model: active row, selection, scroll-into-view
5grid.css styles
6App.jsx the view: wires it all togetherThe pure modules (virtual.js, sortRows.js) have no React in them. They're the parts you'd unit test, and the parts you could reuse in a different grid.
The key idea of virtualization: a tall spacer element gives the scroll container its full height (10,000 × 36 px), and only the visible rows are rendered, absolutely positioned at their offsets. The browser scrolls as if every row existed.