DEV Community

Cover image for Styled-components: Friend or foe?

Styled-components: Friend or foe?

Mía Salazar on January 08, 2024

Versión en español I recently started using Styled-Components for a project and I found it incredibly brilliant at times, and the strangest thing ...
Collapse
 
moopet profile image
Ben Sinclair • Edited

What do you mean by, "you can use SASS syntax without having to have SASS installed"?

I'm not a fan of styled components - I think they don't add much except an extra layer of complexity nobody needs, and they're not very portable, so pretty much what you said in your "cons" section.

EDIT: by the way, embedded code blocks here will do syntax highlighting for you so you don't need to embed images of text. That would make it accessible to people using screen readers.

Collapse
 
brense profile image
Rense Bakker

React in general isn't great for semantic HTML though. Also styled-components is kinda old... There are much better/newer css in js libraries that continued down the same path and made it much better. Take a look at PandaCSS for example, especially their slots API is amazing for creating component libraries panda-css.com/docs/concepts/slot-r... but they also offer simpler ways of writing styles and all with great auto complete and exceptionally well optimized.