-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
The problem
I would like to have a Next.js 13 Layout
component (eg. RootLayout
) that is a Server Component, and have my styling for that layout also stay in Server Components (potentially even in the same app/layout.tsx
file). I only want to switch to a Client Component if there is some client-only features I'm using such as useState
.
This also aligns with the current guidance (as of Jan 2023) from the Next.js team to just leave everything a server component until you absolutely need a client component.
Proposed solution
It would be great if Emotion would be able to be used in React Server Components (without conversion to a Client Component)
Alternative solutions
- Only a subset of Emotion could be supported in React Server Components - eg. the part that is statically extractable / zero-runtime
- Use Client Components via
'use client'
every time that a page should be styled - Switch to a different styling solution which can be used in React Server Components (eg. CSS Modules)
Additional context
Moved from this other issue about Next.js 13 app/
directory support: