Next.js Discord

Discord Forum

Styled-Components compatibility with NextJS 13 and Server components

Unanswered
Longtail tuna posted this in #help-forum
Open in Discord
Longtail tunaOP
Now that Discord posts are being index for the web I thought I'd see if we can get an official response for everybody who's unable to use server components due to the incompatibility with CSS-IN-JS solutions.

For those of us who hate Tailwind, which seems to be being pushed as an official solution now, is there any hope on the horizon?

I understand this not necessarily a Next JS issue but an issue with server components in particular and one which might require the input of the CSS-IN-JS library authors, but is anybody working on this? For many of us server components seem like a massive step backwards.

2 Replies

at the moment the CSS-in-JS libraries require the usage of useServerInsertedHTML to work with the new app dir, and this hook only works with client components. I am not sure there is any estimative of when these libraries are gonna work with RSC because they all rely on runtime JavaScript
you can see the discussion in the emotion repo for more details: https://github.com/emotion-js/emotion/issues/2928