Skip to content

Commit

Permalink
Link to nextjs docs re app-directory SSR (#946)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed Oct 14, 2023
1 parent 7814cfd commit e57a5aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sections/advanced/server-side-rendering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ Refer to [our example](https://github.com/vercel/next.js/tree/canary/examples/wi

On this version, you [only need to add](https://github.com/vercel/next.js/blob/canary/examples/with-styled-components/next.config.js) `styledComponents: true,` at the compiler options in the `next.config.js` file and modify `_document` file with `getInitialProps` as in this [example](https://github.com/vercel/next.js/blob/canary/examples/with-styled-components/pages/_document.tsx) to support SSR.

#### App directory

For routes defined in the `app/` directory, in Next.js v13+, you'll need to put a sytled-components registry in one of your layout files, as [described in Next.js docs](https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components). Note that this depends on styled-components v6+. Also note that the `'use client'` directive is used - so while your page will be server-side rendered, styled-components will still appear in your client bundle.

### Gatsby

[Gatsby](https://www.gatsbyjs.org/) has an official plugin that enables server-side rendering for styled-components.
Expand Down

0 comments on commit e57a5aa

Please sign in to comment.