From the Next.js docs:
Warning: CSS-in-JS libraries which require runtime JavaScript are not currently supported in Server Components.
The following libraries are supported in Client Components in the app directory:
- styled-jsx
- styled-components
- style9
Questions
use-client
directive in every component that uses StyledComponents?use-client
directive at top, and then just import these Client Components as needed into the Server Components?app
directory are Server Components by default. If we save a component outside the app
directory and import it into a Server Component in the app
directory, will that imported function then also become a Server Component?I'll try my best to answer your questions.
Hope it helps.