Backstory: We submitted PR #4332 (https://github.com/styled-components/styled-components/pull/...) to styled-components in July 2024 with React 18 optimizations. When maintenance mode was announced, we turned that PR into this fork.
What we fixed: - Added React 18's useInsertionEffect - Rewrote streaming SSR for React 19 - Replaced ES5 output with modern JS - Optimized array operations with native flatMap - Fixed Next.js App Router to work without 50+ lines of boilerplate
Linear tested it and saw 40% faster initial renders with zero code changes.
How to try it: npm install @sanity/styled-components@npm:styled-components
Or for React 19: npm install @sanity/css-in-js@npm:styled-components
Benchmark tool to test yourself: https://css-in-js-benchmarks.sanity.dev/
We named it "last-resort" because that's what it is. We're not trying to maintain styled-components long-term - we're actually migrating to vanilla-extract ourselves. This is just a performance bridge while teams migrate properly.
The React team recommends moving away from runtime CSS injection. We agree. But migrations take time, and production apps need to ship today.