Warning: Prop `className` did not match. Server: "x" Client: "y"
A prop rendered on the server differs from the client — usually CSS-in-JS class names or random IDs.
Seen on:
React
Meaning
styled-components/emotion/MUI need SSR setup so server and client generate identical class names; random values (Math.random, Date) differ too.
Common causes
- CSS-in-JS without SSR configuration (Next.js)
- Random/time-based values in render
- Different data on server and client
⚡ Quick fix
- Configure the styling library for SSR (Next.js compiler styledComponents: true / emotion cache)
- Use useId for IDs
- Move random values into effects
Detailed fix by platform
React
- jsx
// next.config.js compiler: { styledComponents: true }
How to diagnose
- Prop — Which prop?
- Values — Server vs client value
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026