Back
Web Fundamentals

List Virtualization: Render Large Lists Efficiently

On this page

hardPerformance

List Virtualization: Render Large Lists Efficiently

TL;DRRender only visible items + small buffer. Use FixedSizeList for uniform items, VariableSizeList for dynamic heights.
Very High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

List virtualization renders only the items currently visible in the viewport plus a small overscan buffer. This keeps DOM node count low (~10-20) even with 10,000+ items, dramatically improving scroll performance, memory usage, and initial render time.

Instead of building the entire 10,000-item wall (huge DOM, slow scrolling), you only build the small section the user can currently see through a moving window, plus a little extra on each side for smooth movement.

Full Dataset (10,000 items)
Viewport + Overscan (~15 items)
Only these items exist in DOM
Scroll → Recycle & Reuse

1Fixed Size Lists

Use when all items have the same height. Extremely fast and simple.

FixedSizeList.tsxtsx
import { FixedSizeList } from 'react-window';

<FixedSizeList
  height={600}
  itemCount={10000}
  itemSize={80}
  width="100%"
  overscanCount={5}
>
  {Row}
</FixedSizeList>

2Variable Size Lists

For items with dynamic heights. Requires height estimation and cache management.

3Grid Virtualization & Infinite Scroll

Use FixedSizeGrid for 2D layouts. Combine with InfiniteLoader for infinite scrolling.

4Advanced Patterns

Scrolling to items, memoized rows, custom scrollbars, and accessibility support.

PropertyRegular ListVirtualized List
MemoryHighVery low
Best ForSmall lists (< 100 items)100+ items
Dom NodesAll items (10,000+)~10-20
Scroll Fps~15fps60fps

Regular List

Memory

High

Best For

Small lists (< 100 items)

Dom Nodes

All items (10,000+)

Scroll Fps

~15fps

Virtualized List

Memory

Very low

Best For

100+ items

Dom Nodes

~10-20

Scroll Fps

60fps

Common questions

  • ›“How do you render a list of 10,000 items efficiently?”
  • ›“Explain how react-window works.”
  • ›“What are the trade-offs of virtualization?”
  • ›“How do you implement infinite scroll with virtualization?”

What interviewers look for

  • Understanding of windowing and recycling
  • Knowledge of FixedSizeList vs VariableSizeList
  • Awareness of overscan, item keys, and accessibility
  • Practical patterns (InfiniteLoader, memoization)

Short answer (60 sec)

Use react-window's FixedSizeList or VariableSizeList to render only visible items + overscan buffer. This keeps the DOM small and scrolling smooth even with massive datasets.

Detailed answer (senior level)

Virtualization recycles DOM nodes as the user scrolls. FixedSizeList is fastest for uniform heights. VariableSizeList handles dynamic content but needs good height estimation and cache resets. Combine with InfiniteLoader for infinite scroll. Always memoize row components and use stable keys. Test with large datasets and monitor scroll performance.

  • Virtualizing small lists (< 100 items)
  • Not providing accurate item heights in VariableSizeList
  • Forgetting overscanCount (jerky scrolling)
  • Not memoizing row components
  • Ignoring accessibility (ARIA roles, focus management)
Key Takeaways
  • ✓Virtualization renders only visible + buffer items
  • ✓FixedSizeList for uniform heights, VariableSizeList for dynamic
  • ✓Use InfiniteLoader for infinite scrolling
  • ✓Memoize rows and use stable keys
  • ✓Add proper ARIA attributes for accessibility
  • ✓Measure with large datasets — don't guess
  • ✓Combine with code splitting for optimal results

Related web fundamentals topics

Continue with closely related browser and frontend engineering concepts.

Adaptive Loading: Optimize for Device & NetworkWeb Workers vs Main Thread: Offloading Heavy WorkImage & Video Optimization: Modern Formats & TechniquesMemory Leaks in Frontend Apps: Detection & PreventionText Compression: Gzip and BrotliManaging Third-Party Scripts: Optimization Strategies
Previous TopicAdaptive Loading: Optimize for Device & NetworkNext Topic Web Workers vs Main Thread: Offloading Heavy Work