0
Challenge · 74Architecture & State
Virtualization
Perfused in ~30% of apps
Render 10,000 rows the naive way and the browser builds 10,000 DOM nodes it must lay out, paint, and keep in memory — the page janks before it ever finishes mounting. Virtualization renders only the handful of rows the user can actually see, so a list of any size stays as cheap as a single screenful.
Core idea. A windowing library renders only the rows inside (and just around) the scroll viewport, while a sized spacer fakes the full scroll height — so the DOM node count stays roughly constant no matter how long the underlying list is.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
<List rows={10,000} />
DOM ROWS RENDERED
18
of 10,000 rows
WORK SAVED
100%
nodes never created
Row 0index 0
Row 1index 1
Row 2index 2
Row 3index 3
Row 4index 4
Row 5index 5
Row 6index 6
Row 7index 7
Row 8index 8
Row 9index 9
Row 10index 10
Row 11index 11
Row 12index 12
Row 13index 13
Row 14index 14
Row 15index 15
Row 16index 16
Row 17index 17
Scroll the list. With virtualization ON, only the ~18 rows in (and just around) the viewport exist in the DOM — the tall inner spacer fakes a 10,000-row scrollbar. Flip it OFF and all 10,000 nodes mount at once.
↑ play a little first, then dig in