Menu

Quotes in a style tag broke hydration in my Framer code component
📰

Quotes in a style tag broke hydration in my Framer code component

DEV Community: react·Shashank Thigale·9 days ago
#Fls1ex2T
#devtoreact#devto#dev#ddd#server
Long article (503 words) — no AI summary yet.
Reading 0:00
15s threshold

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 > ) }

Enter fullscreen mode

Exit fullscreen mode

In the editor this is fine, because the editor renders on the client only.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.