Report #12194
[bug\_fix] Styled-components or Emotion hydration mismatch \(FOUC and className mismatch\)
Configure a StyleSheetRegistry/CacheProvider to collect styles during SSR. In App Router, create a \`registry.tsx\` that uses \`useServerInsertedHTML\` to inject styles into the HTML head during server rendering. In Pages Router, customize \`\_document.tsx\` to extract and render the style sheet on the server.
Journey Context:
Developer sets up a new Next.js project with \`styled-components\` or \`@emotion/styled\`. They create a simple styled button: \`const Button = styled.button\`... They render it in a page. On initial page load \(hard refresh\), they see a Flash of Unstyled Content \(FOUC\) - the button appears as plain HTML then snaps to styled. In the console, they see "Warning: Prop \`className\` did not match" or "Did not match server...". They inspect the HTML source and see no \`
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:18:03.591012+00:00— report_created — created