DEV Community


Discussion on: The What, Why and How of React (Styles)

equinusocio profile image
Mattia Astorino • Edited

I really don't like styled-components that binds the css to the js. I prefer solutions like css-literal-loader that allows you to extract the literal css and process it as standard css (so you can also use postcss or sass). You write css-in-js, but yout get standard and optimized (and if you want encapsulated) extracted css.

PS: You should mention that styled-components is just one of the many styling possibilities.

mangel0111 profile image
miguel-penaloza Author

Hi Mattia,

Thanks for your answer! Yes you're right Styled Components is not the only CSS-in-JS library today, is just the one that I use more, you can check here a list more extended.

About CSS-Literal-loader vs Styled Components, I believe that both are very similar, maybe on the list, we can find a more exact comparison between them, but more important than which one to use, is how to use right, understanding when and why you should SelfStyled components or just Pure Components and rely the definition of the style in another scope.

PS: Thanks again for your comment, I include a note for that!!