re: What is Your Opinion about CSS(-in-JS)? VIEW POST

VIEW FULL DISCUSSION
 

I have lots of experience with BEM-Style and Object-Style CSS (Sass, Postcss) and a little (as in hobby) with CSS-in-JS with "Styled Components".

What I miss when I do CSS-in-JS is the big-picture-overview of the whole styling-system. I often look at the files in the styles-folder, the mixins, the variables etc. to keep a feel for it. For me that's important in order to decide where to add styles, where to refactor, when to use !important, when to use utility-classes. With styled-components, I lose that overview. Every component has to fend for itself.

What I really like about styled-components is that I don't have to think about classnames and scope so much. Having the component and styles in one file is also a big plus.

I can totally see how somebody without years of experience with CSS might prefer the JS-way, and I don't think it's a bad choice at all. For me the classic way just feels more "at home", since at work I don't do SPA-style websites.

code of conduct - report abuse