Report #88606
[bug\_fix] Hydration failed because the initial UI does not match what was rendered on the server. Warning: validateDOMNesting\(...\): cannot appear as a descendant of \(or similar for inside , inside , etc.\)
Ensure valid HTML nesting according to HTML5 spec. Block elements like , , cannot be children of inline elements like or . elements cannot contain interactive elements or other tags. Restructure the JSX to use valid semantic HTML—often replacing with for container purposes, or ensuring rich text components don't wrap block content in tags.
Journey Context:
You build a RichText component that renders CMS content inside a tag. The CMS returns HTML with wrappers or blockquotes. In development, React warns about validateDOMNesting. In production with SSR, hydration fails entirely because the browser auto-closes the tag when it sees the , creating a DOM mismatch between server HTML and client expectations. You inspect the HTML source and see the server sent ...
but the browser parsed it as
...
... You fix it by changing the RichText wrapper from to or using a tag that allows block children.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T07:18:56.327643+00:00— report_created — created