Course contentsShow
← React
Lesson 1277 of 2,39632. Lists and Keys Deep DiveFree lesson

When Virtualization is Worth It

Identify scenarios where virtualization helps: 100+ items with complex markup, or 1000+ simple items.

When Virtualization is Worth It

You'll learn: How to identify when the performance benefits of virtualization outweigh its implementation complexity.

Virtualization isn't free—it adds code complexity, bundle size, and edge cases to handle. So when does it actually pay off?

The 100+ Complex Items Threshold

If you're rendering 100 or more items with complex markup (multiple DOM nodes per item, nested components, event handlers), virtualization becomes worthwhile. Each complex item might contain dozens of DOM elements, and browsers slow down managing thousands of nodes simultaneously. Think of a data table with 200 rows where each row has 8 cells with buttons, badges, and formatted text—that's a prime candidate.

The 1000+ Simple Items Threshold

For simple items (a single <li> with text, minimal children), you need closer to 1,000+ items before virtualization pays dividends. A thousand <div> tags with plain text doesn't strain modern browsers much, but ten thousand starts causing scroll jank and memory pressure.

Real-World Indicators

You need virtualization when users experience:

  • Scroll lag: The list doesn't keep up with scrolling
  • Initial load delays: The page freezes while rendering
  • Memory bloat: Browser DevTools show high memory usage
  • Mobile struggles: Works on desktop but crawls on phones

When Virtualization Is Overkill

Don't virtualize if you have fewer than 50 items, or if your items already lazy-load through pagination. Adding a library like react-window for 30 list items creates more problems than it solves—you'll battle layout shifts, focus management, and accessibility issues for negligible gain.

Key Takeaway: Virtualize when you have 100+ complex items or 1000+ simple items causing measurable performance issues. Otherwise, the added complexity isn't worth it.