Gold upgrade planned

Available to study now. Gold Edition improvements will be added one chapter at a time.

Chapter 10 of 10
Course Progress0 of 10 completed (0%)

Modern Full-Stack & React Internals · Chapter 10 of 10 · ~15 min

Project: Virtualized Data Grid

Render 10,000+ rows at 60fps by mounting only the visible viewport window, adding overscan, resetting scroll on filter, and supporting keyboard row navigation.

  • Calculate windowed start/end indices with overscan
  • Keep DOM node count O(1) regardless of row count
  • Reset scrollTop when filters shrink the dataset
  • Sync ArrowUp/ArrowDown keyboard focus with scroll position

Project: Virtualized Data Grid: learn it visually

Build a windowed 10,000-row data grid with overscan math, live search filtering, keyboard row navigation, and render performance profiling.

Project: Virtualized Data GridBuild a windowed 10,000-row data grid with overscan math, live search filtering, keyboard row navigation, and render performance profiling.UNDERSTANDProjectFOLLOW THE FLOWVirtualized DataGridAPPLY ITwindowedProject: Virtualized Data GridBuild a windowed 10,000-row data grid with overscan math, live search filtering, keyboard row navigation, and render performance profiling.UNDERSTANDProjectFOLLOW THE FLOWVirtualized DataGridAPPLY ITwindowed

1Windowing Math & Performance Profiling

Mounting thousands of DOM rows stalls layout and paint. Windowing turns a 10,000-row table into ~10–15 positioned nodes.

Wrong idea: Render all 10,000 rows in the DOM and hide off-screen ones with CSS

10,000 <tr> nodes mounted
Slow initial mount & 120ms scroll jank

Even hidden DOM nodes consume layout, style recalculation, and memory, freezing scrolling on large datasets.

Real system: Mount only the visible window + small overscan buffer

16 <tr> nodes mounted (O(1) DOM)
Smooth 60fps scroll at any dataset size

Compute startIndex and endIndex from scrollTop / rowHeight so React mounts ~16 rows instead of 10,000.

2Live Project Lab: 10,000-Row Virtualized Grid

Scroll through 10,000 service rows, filter by name or region, adjust Overscan, and watch the mounted DOM count stay tiny.

Live Project · 10,000-Row Virtualized Data Grid
Mounted DOM rows: 8 / 10,000
Overscan:
#1auth-apius-east12 ms
#2billing-workereu-west29 ms
#3search-edgeap-south46 ms
#4analytics-etlus-east63 ms
#5auth-apieu-west80 ms
#6billing-workerap-south97 ms
#7search-edgeus-east114 ms
#8analytics-etleu-west131 ms

Window slice [0..7] · Active row #1 · Click grid and press ↑ / ↓

Predict first

With rowHeight = 40, viewportHeight = 200, scrollTop = 400, and overscan = 2, what is the clamped start index?

const start = Math.max(0, Math.floor(400 / 40) - 2);

3Bug Hunt · Window Range Math

Fix getVisibleRange so it applies overscan and clamps both ends safely inside [0, totalRows].

Bug Hunt · virtualWindow.ts
TypeScript

🎯 Find and fix the bugs in the code above, then press Run & verify to test your solution.

Need a hint?

Use Math.max(0, Math.floor(scrollTop / rowHeight) - overscan) and Math.min(totalRows, ...).

4Knowledge Check

Concept Check 1 of 2
1

Why do virtualized grids add a small overscan buffer above and below the viewport?

Concept Check 2 of 2
2

What should happen to scrollTop when a user types a search filter that reduces 10,000 rows to 5?

5Recap & Course Graduation

Congratulations! You've Completed Modern Full-Stack & React Internals

Ready to claim your graduation milestone?

Enjoying this free lesson? Your support helps us build more free animated chapters.

Support Us