Every blog page on my Remix site threw React errors in production, on every load, for months. The pages looked fine, so nobody noticed.
The cause was one line I had copied into every page:
<style>{css}</style> How I found it
I build Shopify apps, and most of them have a blog. Before merging a new post, I had Claude Code check it in headless Chrome for console errors, sideways scroll and anything covering anything. The new post was clean. The older posts were not. Every one of them logged the same three minified errors:
Minified React error #425 Minified React error #418 Minified React error #423 That's "text content does not match server-rendered HTML", "hydration failed", and "the entire root will switch to client rendering". The site runs React 18.2 on Remix 2.16.
What the server actually sent
Each page kept its CSS in a template string at the top of the file and rendered it as a child of <style>. Two of the rules had quotes in them:
body { font-family: 'Inter', system-ui, sans-serif; } .nav-links a:not(.nav-btn):not([href="/blog"]) { display: none; } React escapes text children when it renders on the server. Inside a <p> that's exactly what you want. Inside a <style> it breaks things, because browsers don't decode HTML entities in style text. This is what reached the browser:
body { font-family: 'Inter', system-ui, sans-serif; } .nav-links a:not(.nav-btn):not([href="/blog"]) { display: none; } So on first paint the body font rule was broken, and the phone rule that hides extra nav links never matched. Then React hydrated, compared the style text it expected with the escaped text from the server, found a mismatch, and threw away the server HTML to render the whole page again in the browser. After that re-render the CSS was correct, which is why the pages looked normal and the bug hid so well.
The fix
<style dangerouslySetInnerHTML={{ __html: css }} /> With dangerouslySetInnerHTML, React writes the string as is, so the quotes survive and the server HTML matches what the client renders. My landing page and my newest post already used this form, which is why those two were clean.
It's only safe because css is a fixed string in the source file. I checked all 22, and none of them puts anything into the CSS through ${}. Never pass user input through this.
After the change, all 22 pages had zero escaped quotes in their CSS and zero errors in the console, on desktop and phone widths.
Check your own site
The browser won't show you the problem, because by the time you open DevTools, React has already re-rendered the page and the style text in the DOM looks correct. Look at the raw HTML instead:
curl -s https://your-site.com/some-page | grep -o "<style>[^<]*'" | head -3 Any output means a style block left the server with escaped quotes. Search for " too. The other sign is minified React errors #418, #423 or #425 in your production console.
The bug was on the blog of EZstock, my inventory app for Shopify. View the source there to see the fixed version.
I wrote this with help from Claude, which also ran the browser checks that found the bug.


