DEV Community

Discussion on: Why I don't like to use Styled-Components

Collapse
 
aleksandrhovhannisyan profile image
Aleksandr Hovhannisyan

CSS in JS doesn't make sense, so there's that

Why not? The DOM has native methods for generating styles programmatically and inserting them into a document. It's not a new concept, even though it's been popularized and made easier by JS frameworks.

I highly recommend styled-jsx—it's basically just CSS.

Collapse
 
oenonono profile image
Junk • Edited

Everything I said as well as several other things I haven't. Any solution to which what I said does not apply (such as shipping CSS that is not in JS or writing CSS that is not in JS or both) is categorically not what I am referring to. How much one considers writing a semi-sorta-vanilla CSS/JS hybrid embedded in JS, composed as special React components wrap or hooks control rather than as standard CSS composes onto nodes, and distributed as runtime-compatible CSS only after passing it through a stack of tools as "CSS" or as "CSS in JS" I cannot dictate.

PS: That particular approach is certainly one of the better in several ways. It's not as if I don't use CSS in JS sometimes. That's why I have an opinion on it.