I see a ton of cool stuff happening in CSS in JS. I think it solves a lot of interesting problems for certain websites. For example, I very much like the idea of having the option to write styles that are scoped to a component programmatically. And thus are tree-shaked out when the component isn't used automatically.
But the web is a big place, and dare I say most websites aren't built with JavaScript-powered component models. Thus, CSS-in-JS isn't necessary or appropriate for a lot of sites.
Two things though to be clear:
You can't have CSS-in-JS without CSS. CSS-in-JS is still styled that are applied to elements. It doesn't absolve you from learning CSS.
The CSS-in-JS landscape is wide. It's a little hard to talk about so vaguely. Each project in the bucket of CSS-in-JS handles things a bit differently and how the styles are applied to the site is even quite wide. I think it sometimes gets lost in the arguments that some of the approaches literally make a CSS stylesheet that you link up like you would any other CSS, even Sass-produced CSS, which there doesn't seem to be much argument about anymore.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
CSS or CSS in JS?
I see a ton of cool stuff happening in CSS in JS. I think it solves a lot of interesting problems for certain websites. For example, I very much like the idea of having the option to write styles that are scoped to a component programmatically. And thus are tree-shaked out when the component isn't used automatically.
But the web is a big place, and dare I say most websites aren't built with JavaScript-powered component models. Thus, CSS-in-JS isn't necessary or appropriate for a lot of sites.
Two things though to be clear: