Next.js Developer interview question
A Next.js page shows a hydration mismatch error. What causes it, and how do you fix it?
Scenario Asked in Frontend Engineer · Full Stack Engineer interviews
Summary
The HTML rendered on the server differs from what React renders on the first client render. Common causes are
values that differ between server and browser (dates, time zones, random IDs, window/localStorage checks),
invalid HTML nesting the browser rewrites, and browser extensions that modify the page.
Keep reading with a membership
The full answer with examples, key points and comparisons is part of the membership, along with every other interview answer, progress tracking and Daily Review. Most-asked answers stay free to read.
More Next.js Developer questions
- How did caching defaults change in Next.js 15?
- Explain SSR, SSG, ISR and CSR in Next.js.
- How does data fetching work in the App Router?
- What is the difference between Server Components and Client Components?
- What is Next.js and what problems does it solve on top of React?
- Explain the App Router file conventions: page, layout, loading, error, not-found, template and route.
- What are the differences between the App Router and the Pages Router?
- What are Server Actions and how do you use them for mutations?