I sell Framer code components, and one of them worked perfectly in the editor, then threw a hydration error on the published site. The page still rendered, but the console showed React error #425 ("text content does not match server-rendered HTML").

The cause was two kinds of characters in the CSS: quotes and >.

The setup

Framer code components are React components. A common way to ship their styles is a <style> element with a template string inside:

export default function Accordion(props) { return ( <div className="acc"> <style>{` .acc [data-state="open"] .panel { display: block; } .acc > .item { border-top: 1px solid #ddd; } `}</style> {/* ... */} </div> ) } 

In the editor this is fine, because the editor renders on the client only. A published Framer site renders the page on the server first and then hydrates it in the browser, and that's where it broke.

What went wrong

On the server, the text inside <style> was escaped like any other text: " became &quot; and > became &gt;. In the browser, <style> is a raw text element, so those entities are never decoded. The browser kept &quot; as literal characters in the CSS.

So the server HTML and the client render disagreed about the style text, React reported the mismatch, and the selectors with escaped characters stopped matching anything.

The fix

Write the CSS so it has nothing to escape:

<style>{` .acc [data-state=open] .panel { display: block; } .acc .item { border-top: 1px solid #ddd; } `}</style> 
  • Attribute selectors don't need quotes when the value is a plain word: [data-state=open] works the same as [data-state="open"].
  • Replace the child combinator > with a descendant selector or a class on the child.
  • No content: "..." strings. If you need generated text, put it in the markup instead.

JavaScript inside ${...} in the template string is fine, because it runs before React ever sees the text.

How to catch it before buyers do

The editor will never show this bug. Publish the site, open it in a normal browser tab and check the console for React's "recoverable error" messages, numbers #418, #421, #423 and #425. Those are hydration mismatches. If you see one, look for anything your component renders differently on the server than on the client: escaped text, dates, random ids or window checks.

A related trap: don't build class names or CSS selectors from useId(). Framer's server render adds copies of components for breakpoint variants, so the ids can shift between server and client.

I keep the rest of what I check before submitting a template or component in one place: the Framer template checklist I use before every submission.

Have you hit a hydration error that only showed up on the live site? What caused it?