A mismatch means the HTML rendered on the server does not match the first client render. The usual causes are dates and locale formatting, random values, reading window or localStorage during render, and invalid HTML nesting that the browser silently repairs. Read the diff React logs to find the node, then either move the value into an effect so the first render matches, or render that part on the client only.
Why interviewers ask this
Hydration errors are a rite of passage for anyone doing server rendering, and the answer shows whether you have shipped it. The interviewer wants a systematic approach rather than a shrug and a suppressHydrationWarning. They are also checking that you know why mismatches matter, since React discards the server markup for that subtree and can leave event handlers attached to the wrong nodes.
How to structure your answer
- Define the mismatch as server HTML against first client render.
- List the usual suspects in order of likelihood.
- Describe how you narrow it down from the logged diff.
- Give the correct fixes and when suppression is acceptable.
Example answer
First I read the error properly, because React 19 gives you a decent diff showing which node differed, and that is usually enough to name the culprit. Then I run the suspects. Anything time based is number one, so a formatted date or a relative timestamp rendered on the server at one second and on the client at another. Then locale and time zone formatting, because the server is almost always UTC. Then random ids or Math.random in a component. Then anything reading window, matchMedia or localStorage during render, which is common with theme toggles. And finally invalid nesting, like a div inside a p, where the browser fixes the HTML before React sees it. The fix depends on which one it is. For genuinely client only values I render a stable placeholder on the server and set the real value in an effect, or lazy load that piece with server rendering turned off. I only reach for suppressHydrationWarning on a single leaf like a timestamp, never on a wrapper.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- Why is a hydration mismatch worse than just a console warning?
- How would you handle a theme toggle that reads localStorage?
- What does React do with the server HTML for a subtree that mismatched?
Related react developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions