Back
Web Fundamentals

List Virtualization: Render Large Lists Efficiently

Web Fundamentals
Build & Deployment: Monorepo, CI/CD, Strategies & Release SafetyState Management: Choosing the Right SolutionRedux: Predictable State Container (RTK + RTK Query)React Query (TanStack Query): Server State CachingData Fetching Patterns: REST, GraphQL, tRPC & Real-timeGraphQL Fundamentals for Frontend: Shape, Caching, and TradeoffsgRPC-Web Fundamentals: Browser Constraints and Proxy ModelCaching Strategies: Client, Server & EdgeData Normalization: Organizing State for PerformanceAPI Design Best Practices: Pagination, Errors, Versioning & Type SafetyAPI Versioning Strategies for Frontend CompatibilityPagination: Offset vs Cursor-BasedRate Limiting & API Resilience: Retries, Backoff, Jitter, IdempotencyHow Frontend Developers Can Handle Millions of API Requests Without Crashing EverythingBrowser Storage: Cookies, SessionStorage, LocalStorage, IndexedDBReal-time Communication: WebSockets, SSE & PollingWebRTC: Real-Time Communication in the BrowserCore Web Vitals: LCP, INP & CLSPerformance Optimization Trade-offsCritical Resource Prioritization: Optimize Loading OrderCode Splitting: Optimize Bundle Size with Dynamic ImportsTree Shaking: Eliminate Dead Code from Your BundleLazy Loading: Load Resources On-DemandResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip and BrotliImage & Video Optimization: Modern Formats & TechniquesAdaptive Loading: Optimize for Device & NetworkList Virtualization: Render Large Lists EfficientlyWeb Workers vs Main Thread: Offloading Heavy WorkMemory Leaks in Frontend Apps: Detection & PreventionManaging Third-Party Scripts: Optimization StrategiesHow CDNs Work: Edge Delivery, Caching & PerformanceHTTP Caching Deep Dive: Cache-Control, ETag & RevalidationService Workers & Offline Strategy: Cache First, Network First & Update LifecyclePWA Fundamentals: Manifest, Installability & Offline UXCritical Rendering PathScript Loading: async vs deferEvent Loop: Understanding JavaScript Execution ModelJavaScript Module Systems: CJS vs ESM vs UMDDynamic Module Loading: import() FunctionImport on Interaction: Load When User InteractsImport on Visibility: Lazy Loading with IntersectionObserverBrowser Rendering Pipeline & Layout ThrashingRendering Strategies: CSR vs SSR vs SSG vs ISRStreaming SSR: Progressive HTML StreamingIslands Architecture: Independent Component HydrationReact Server Components: Zero-JS Server RenderingFramework Reactivity: React, Vue, Svelte & SolidHTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC) for Frontend PerformanceDNS Resolution: Path, TTL, Caching & Frontend ImpactCross-Site Scripting (XSS) AttacksCross-Site Request Forgery (CSRF) AttacksCORS Explained: Cross-Origin Resource SharingCORS Preflight in Practice: Credentials, Simple Requests & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? Understanding TLS/SSLAuthorization Best PracticesCookie Security & Session Hardening: SameSite, HttpOnly, Secure
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
Previous TopicAdaptive Loading: Optimize for Device & NetworkNext Topic Web Workers vs Main Thread: Offloading Heavy Work

On this page