Why I never understood CSS-in-JS

The full article is available here.

CSS code in JavaScript file?

No, please.

Afraid of applying styles elsewhere?

Embrace the cascade.

Class name conflicts?

Not anymore, thanks to naming convention and project structure.

Cannot find CSS file?

Document and adapt to the project architecture.

Wanna read and use CSS variables in JavaScript?

Of course you can.

Wanna adopt the hottest new trends?

Yes, but without reinventing the wheel.

“Serializing” styles before inserting into the document?

What? I mean, what?

To load styles I need JavaScript?

No, I don’t.

Performance issues with CSS-in-JS?

Plain CSS doesn’t have them.

Utility classes?

Yes, but not the whole framework.



Go back to site