Q32: What causes React Hydration Errors during Server-Side Rendering (SSR)?
Hydration errors occur when the pre-rendered HTML sent by the server does not match the initial Virtual DOM tree generated by React on the client (e.g., using window, dynamic dates, or non-deterministic IDs).
Key Takeaways
- Mismatch between server-generated HTML markup and client rendered tree causes hydration failures.
- Avoid accessing browser-only globals (
window,localStorage) during initial render.
Knowledge Check
Which scenario commonly triggers a React SSR hydration mismatch warning?