DEV Community

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

Collapse
 
moopet profile image
Ben Sinclair

I think that CSS in JS is almost always the wrong answer to a question nobody really asked.

Yes, we've lost something.

Collapse
 
vguleaev profile image
Vladislav Guleaev

Exactly

Collapse
 
marcusyoda profile image
Marcus Vinícius

Most JS frameworks are going back to the days where we put php and html together and a file with everything mixed up! So it was natural that they wanted to put the css in there ...

Speaking as a web developer who likes to guarantee access for everyone, I think that processing styles with js is a waste of performance, battery and time!

Collapse
 
jrop profile image
Jonathan Apodaca

The one exception to this, that I find great pleasure in using, is the approach used by Next.JS: styled-jsx. It is basically scoped style tags in the context of React components. It supports everything that you would expect from CSS as well: media queries, etc.