Skip to main content
InterviewHubPRO
Section Overview
Q35

Question 35 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

70%
Next.js & App Router (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Diagnosing and Eliminating Hydration Mismatches.

senior LevelSSR & HydrationSystem Design

In Simple Words: Occurs when the server-rendered HTML diverges from the initial client render:

  • Common culprits:
    1. Using typeof window !== 'undefined' to conditionally render HTML.
    2. Rendering non-deterministic values: new Date(), Math.random().
    3. Invalid HTML nesting (e.g. <p><div>Text</div></p> or <table><tr>).
    4. Browser extensions injecting DOM nodes (e.g. password managers).
  • Fixes: Use suppressHydrationWarning on specific nodes, or defer rendering client-only values until mounted via useEffect with hasMounted flag.