DEV Community

loading...

Discussion on: CSS in JS - have we done something wrong?

Collapse
facundocorradini profile image
Facundo Corradini • Edited

There are many pros and cons to CSS-in-JS, but I believe it goes way past opinions and pros/cons, into neurodiversity territory.

CSS-in-JS is great at making CSS work for the JS-minded, and I would recommend it (preferably in some zero-runtime form) whenever the team is comprised purely by programmers in the traditional sense of that word (i.e. imperative programming CS background). Which is what most teams currently are, as there has been a ginormous shift from desktop and back end tasks into the front end, which made many of those devs switch as well.

Having a CSS expert in charge of the styling, I'd have let them choose whatever architecture they felt comfortable with. It'd let each shine in their own craft.

We can discuss all day if CSS is a programming language or not, but at the end of the day, it's more "language" than "programming". It is very, very contextual. Therefore, it relies primarily in verbal-linguistic intelligence rather than logical-mathematical one.

I've seen quite some companies trying to recruit programmers with claims such as "our designers make the CSS", but that approach is equally wrong. Designers, as in "people that work primarily with graphic tools", rely primarily in visual-spatial intelligence, and will probably struggle with CSS just as much as programmers do.

Each role has its requirements and work with completely different mind structures. Sure, you'll find some folk that can do both, and the occasional unicorn that can do it all. But trying to force someone into a completely different way of thinking usually doesn't end well.

CSS-in-JS can be a bit like trying to drive a screw with a hammer. It'll get int there, but you'll end up with bashed walls and swollen thumbs.