DEV Community

Discussion on: Why not to "Abandon React!!1"

 
rafipiccolo profile image
Raphael Piccolo

What would you use to quit Styled Components ?

Thread Thread
 
merri profile image
Vesa Piittinen

Likely anything that allows for automatical scoping and is zero runtime. CSS Modules possibly, or Linaria if people prefer having styled-like syntax. Personally I'd be fine even with a more traditional SCSS approach, but people don't really handle grooming CSS, and many have challenges to understand conventions like BEM. Scoping makes things a lot easier for most.

For me the major weakness with Styled Components is how much it encourages to do dynamic runtime styling with JavaScript, and because people don't always think what they're doing they add in things like react-spring which I guess feels natural to use: each time I've seen SC I've also seen some spring library added in as well. The problem is springs are for complex animations, but in the actual apps all the real use cases only needed simple two state transitions (such as accordion closed, accordion open). Total overkill to add JS to control the entire animation. Controlling the boolean state is enough.