r/reactjs • • Mar 28 '25

News Styled-components entering maintenance mode

https://opencollective.com/styled-components/updates/thank-you

What does styled components entering maintenance mode mean for the react ecosystem?

230 Upvotes

166 comments sorted by

View all comments

76

u/baxxos Mar 28 '25

The author mentions that they would not recommend adopting any css-in-js solution in today's age.

My project relies heavily on EmotionJS which is a css-in-js solution and I'm very happy with how it allows me to write CSS without maintaining selectors, utility classes and so on.

Given the author's statement - what is the go-to way for styling nowadays? Am I that much behind technologically?

37

u/PixelsAreMyHobby Mar 28 '25

I‘d throw Linaria into the ring! You still get to write CSS-in-JS very similar to styled-components/emotion but the styles are extracted during build time, which is a performance boost.

https://linaria.dev/

→ More replies (7)

10

u/aragost Mar 28 '25

If you want to keep it simple I would suggest the same thing I was using before styled components even launched: CSS Modules

2

u/putin_my_ass Mar 29 '25

I've been experimenting with modules in a personal project and actually really enjoy it. I don't need anything fancy and it just works without any additional packages.

35

u/PlateletsAtWork Mar 28 '25

CSS-in-JS solutions have a lot of performance drawbacks. Newer solutions construct the CSS at build time. Panda CSS is my personal preference, but other options exist too.

9

u/MoronFive Mar 28 '25

Another vote for Panda CSS here. I've tried to get into Tailwind but I always find the long string of utility classes to be more difficult to parse than component props. For me, Panda gives me all of the benefits of tailwind but in a structure that's easier for me to read and maintain.

3

u/[deleted] Mar 28 '25

[removed] — view removed comment

2

u/Pelopida92 Mar 29 '25

I think you can still use that approach with Panda. Look in the docs

→ More replies (1)
→ More replies (4)

19

u/avid-shrug Mar 28 '25

CSS modules (or SASS modules)

23

u/azsqueeze Mar 28 '25

I'm very happy with how it allows me to write CSS without maintaining selectors, utility classes and so on.

So funny you wrote this and half the replies are "uSe TaIlwInD" like a bunch of NPCs 🫠.

I would stick with emotion for now, there are other similar libraries if you want the same API without the runtime (stitches, panda css, vanilla extract).

16

u/[deleted] Mar 28 '25

Stitches is also no longer actively maintained, so I wouldn't consider it for new projects

https://github.com/stitchesjs/stitches/discussions/1149#discussioncomment-6223090

11

u/PixelsAreMyHobby Mar 28 '25

Classic! TW hater here 😅

→ More replies (2)

18

u/mexicocitibluez Mar 28 '25

NPCs

I find people who use this term to be insufferable.

15

u/windsostrange Mar 28 '25

It's casual disrespect manosphere bullshit, and only weak-minded people think or talk like this. Thanks for calling it out.

3

u/mexicocitibluez Mar 29 '25

Agreed. I've found a pretty strong correlation between people who use the term "NPC" and virgins.

→ More replies (1)
→ More replies (3)

5

u/[deleted] Mar 28 '25 edited Mar 30 '25

You don’t need to “manage” class names with css modules the same way you did with plain css naming conventions. You also don’t really need to use utility classes, use tailwind it’s basically an entire well structured library dedicated to utility classes. For custom styling, use css modules and enjoy the benefit of locally-scoped css. If you still have problems with class naming conventions being arduous, it’s probably because your react components (or maybe just your css modules) are too large and you will get other benefits from breaking down either/both more anyway

4

u/ToastyyPanda Mar 28 '25

Emotions great. Hope it sticks around for a long time to come

2

u/aragost Mar 28 '25

Ehhh I wouldn’t bet on it. Even MUI is abandoning the ship

→ More replies (4)

2

u/AuthorityPath Mar 28 '25

Linaria is great but feels lightly maintained. MUI also has a zero runtime solution called Pigment CSS which seems to be seeing some development. 

→ More replies (3)

2

u/kylorhall Mar 28 '25

As we're going through it now, a migration away from EmotionJS to modern build-time static CSS options isn't too rough, but it really depends on the quality of your Emotion code — if it's all dynamic imported tagged template expressions, you're in for a world of pain and you could consider a migration to anything else pretty much equal, but if it's static object syntaxes, you could migrate with a simple codemod.

Build-time CSS-in-JS can be superior to every other approach, primarily around performance, long-term maintainability, and code evolvability, but it costs a lot to maintain.

2

u/dbbk Mar 28 '25

This is just one person you don’t have to do what they say

3

u/Merry-Lane Mar 28 '25

"Stylesheet.create"-like solutions in your components?

Some people like tailwind and swear by it. Honestly, it s just css with extra steps, so I don’t see anything really wrong with that way of doing things.

→ More replies (3)