DEV Community

loading...

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

Collapse
dorshinar profile image
Dor Shinar • Edited

I've been using styled components for roughly 3 years now (on-and-off) for work, and I can describe my relationship with it as a love-hate one. It does take some time to learn how to benefit from it, but I think the pros outweigh the cons, although I would definitely understand why some people would be deterred by it.

Regarding your first bullet - with proper tooling (which exists for both VSCode and WebStorm, and I'm sure others have it as well), it feels damn near close to writing regular CSS. You get the same auto completion, same syntax highlighting, and you can't feel the difference.

For your second bullet - why does it matter if a component is SC or not? Do you care if a component you use is a functional component or a class component? React makes it very easy to thread all those kinds together. You can create a Card component, and whether it's an SC or just a regular component you would use it exactly the same. If you ask me, that's a plus.

And regarding you third bullet - of course. I don't think anyone has ever pitched SC as a "theming engine". You can use SC for theming, same as you can with CSS Variables, or any other method. It's another tool in your belt.

I do think that SC has a lot of merits, but it's definitely not a hill I'd choose to die on.