We were promised elegance. What we sewage was runtime CSS parsing, unreadable people names, and hydration bugs consecutive retired of hell. CSS-in-JS was expected to free america from world namespace nightmares and styling spaghetti.
Instead, it wrapped america successful a shiny caller furniture of chaos — 1 that performs worse, sounds worse, and someway costs much CPU cycles to do what a plain stylesheet did perfectly good 2 decades ago. This is not evolution; I’d telephone it over-engineering disguised arsenic progress.
From Liberation to Performance Lock-In
When CSS-in-JS first appeared, it felt revolutionary. No much world leaks, nary much worrying astir specificity wars, nary much cryptic people collisions. We could co-locate styles pinch components, making everything modular and “self-contained.”
But nan honeymoon ended quickly. Quickly, developers realized that generating styles astatine runtime wasn’t a mini tradeoff — it was a ticking capacity bomb. What started arsenic a measurement to simplify styling turned into 1 of nan astir costly abstractions ever introduced into frontend development.
By tying CSS procreation to JavaScript execution, we efficaciously welded position to logic — nan nonstop point we were trying to debar erstwhile we invented CSS successful nan first place.
The thought of dynamically computing CSS connected nan customer broadside sounds clever, until you’re debugging a hydration mismatch astatine 3 a.m. because immoderate SSR walk decided to hash people names otherwise betwixt nan server and browser. It’s nan benignant of rumor that feels little for illustration a bug and much for illustration a reward for trusting trading copy. CSS-in-JS libraries made the elemental enactment of styling a button arsenic analyzable arsenic dependency injection. And let’s not moreover commencement connected really overmuch bundle size ballooned conscionable to make borders blue.
By tying CSS procreation to JavaScript execution, we efficaciously welded position to logic — nan nonstop point we were trying to debar erstwhile we invented CSS successful nan first place. The elegance of separation was replaced pinch inline chaos wrapped successful hooks and discourse providers.
The Hidden Performance Tax of Convenience
Developers often take sides CSS-in-JS pinch nan statement that “the overhead is negligible.” It’s not. Runtime styling introduces measurable capacity degradation — from nan milliseconds mislaid parsing strings, to nan representation overhead of style recalculations. Anything involving commerce successful integer shape is astatine risk.
Every clip a constituent mounts, nan strategy has to create, inject, and sometimes moreover deduplicate style tags. Multiply that crossed hundreds of components, and you’ve turned your render rhythm into a bureaucratic mess.
What was erstwhile nan web’s biggest advantage — lightweight rendering — is now being sabotaged by overzealous abstraction.
This is not hypothetical. Performance audits consistently show that CSS-in-JS frameworks adhd some web and runtime costs. You mightiness not announcement it connected your 16-core dev machine, but your users connected low-end devices surely do. What was erstwhile nan web’s biggest advantage — lightweight rendering — is now being sabotaged by overzealous abstraction.
The calamity present is that nan browser already has a battle-tested, optimized strategy for handling styles: CSS. We replaced it pinch a JavaScript imitation that’s slower, harder to debug, and occasionally decides to vanish connected page refresh. CSS-in-JS didn’t make styling faster: it conscionable made debugging slower.
And yet, nan rhythm continues. Framework maintainers build spot aft patch, trying to make move styles “feel native.” But you can’t out-optimize nan browser’s ain styling engine. It’s for illustration rebuilding a instrumentality wrong a instrumentality — isolated from this 1 leaks representation and needs an npm update each week.
The Developer Experience (DX) Mirage
Advocates often declare CSS-in-JS improves developer experience. They’re correct — until you really person to support it. At first glance, it feels modern and ergonomic. Styles unrecorded successful your constituent file. Scoped classes consciousness clean. Variables are accessible.
But erstwhile nan codebase scales, nan illusion collapses. You commencement hunting for missing prop interpolations, juggling discourse providers and rewriting logic — each because your styles can’t grip elemental overrides without rewriting half nan constituent tree.
Debugging CSS-in-JS feels for illustration playing Minesweeper pinch people hashes. DevTools turns into a cryptic wasteland of obfuscated selectors. Inspect an constituent and you’ll find thing for illustration .css-4kq0lj{margin:0 auto} — not precisely readable. Good luck tracing that backmost to its root erstwhile you person a twelve styled components inheriting from each different for illustration a dysfunctional family tree.
This obsession pinch “DX” — developer acquisition — has go a smokescreen for architectural debt.
Worse, CSS-in-JS encourages overengineering. Why constitute a elemental media query erstwhile you tin import a hook and toggle nan taxable discourse dynamically? Developers who erstwhile debated whether to usage Flexbox now statement which spirit of runtime styling performs 2% amended connected hydration. The intelligence load is immense. The payoff? Marginal astatine best.
This obsession pinch “DX” — developer acquisition — has go a smokescreen for architectural debt. Sure, it feels bully to import styled-components and constitute CSS successful backticks. But that dopamine deed fades quickly erstwhile your app’s capacity tanks and your build times double. Convenience is not craftsmanship. And CSS-in-JS is convenient astatine nan disbursal of clarity.
The Return to Sanity: A Post-CSS-in-JS Future
Thankfully, nan tide is turning. Even nan astir die-hard CSS-in-JS proponents are starting to admit it’s unsustainable astatine scale. Frameworks for illustration Remix, Astro and Next.js 13 are nudging developers backmost toward simplicity — leveraging accepted CSS, CSS Modules, aliases fixed extraction alternatively of runtime generation. The connection is clear: separation of concerns still matters.
The emergence of CSS variables and container queries, arsenic good arsenic scoped styles, intends modern CSS now handles astir of what CSS-in-JS tried to hole — but natively, efficiently and predictably. No runtime penalties. No hash collisions. No invisible style tags clogging your DOM. Just styles that load instantly and behave consistently.
CSS is not broken; our subject is.
We don’t request to reinvent styling. We conscionable request to respect nan boundaries that made nan web activity successful nan first place. CSS is not broken; our subject is. The reply isn’t much abstraction — it’s amended understanding. The early isn’t astir embedding CSS into JavaScript, but astir penning maintainable styles that standard people pinch nan web’s evolution.
Returning to fundamentals is simply maturity and a normal displacement towards practicality. It’s realizing that adding layers of abstraction to lick problems we created ourselves is not innovation. It’s conscionable axenic denial.
Modern CSS Solves nan Original Problem
CSS-in-JS was calved retired of bully intentions — modularity, predictability and componentization. But what we sewage was complexity disguised arsenic progress. The web didn’t request runtime styling engines aliases cryptic hashes to enactment modern. It needed restraint. It needed developers consenting to judge that not each problem requires a library.
We’re entering a caller section wherever simplicity is sophistication again, wherever world stylesheets coexist peacefully pinch scoped rules. Where nan browser does nan dense lifting, arsenic it was ever meant to, it’s clip to extremity worshipping abstractions that slow america down and commencement trusting nan level we’ve spent decades improving. Ready to make nan move?
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don't miss an episode. Subscribe to our YouTube channel to watercourse each our podcasts, interviews, demos, and more.
Group Created pinch Sketch.
English (US) ·
Indonesian (ID) ·