Next.js Discord

Discord Forum

Style componentes

Unanswered
American black bear posted this in #help-forum
Open in Discord
Avatar
American black bearOP
is there a way to use styled of styled components in server side rendering ?

9 Replies

Avatar
American black bearOP
i have implement that but when a use a componend that includes styled, it says that i have to use 'use client'
Avatar
Broad-snouted Caiman
what you have inside that component ?
Avatar
American black bearOP
jus a component that is using styled.div
Error: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
Avatar
Shy Albatross
last time I checked, styled-components use contex for their provider, so anywhere you use them you have to make client comp, which sucks
Avatar
Somali
No way around this? Does this mean you can’t SSR with them?
Avatar
Great golden digger wasp
you can SSR but you cant use styled-components in RSC right now
Avatar
American black bearOP
is there a way to pass media queries as props to a compoennt? and if so i allows you to do in the server side ?