Skip to content

Commit

Permalink
Mention <title> and styled-jsx caveats in Document's docs (#11499)
Browse files Browse the repository at this point in the history
* Mention <title> and styled-jsx caveats

* Update custom-document.md

Co-authored-by: Tim Neutkens <[email protected]>
  • Loading branch information
vassbence and timneutkens authored Apr 6, 2020
1 parent baf0b28 commit 969ffd6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/advanced-features/custom-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The `ctx` object is equivalent to the one received in [`getInitialProps`](/docs/
- React components outside of `<Main />` will not be initialized by the browser. Do _not_ add application logic here. If you need shared components in all your pages (like a menu or a toolbar), take a look at the [`App`](/docs/advanced-features/custom-app.md) component instead
- `Document`'s `getInitialProps` function is not called during client-side transitions, nor when a page is [statically optimized](/docs/advanced-features/automatic-static-optimization.md)
- Make sure to check if `ctx.req` / `ctx.res` are defined in `getInitialProps`. Those variables will be `undefined` when a page is being statically exported by [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) or by [`next export`](/docs/advanced-features/static-html-export.md)
- Common errors include adding a `<title>` in the `<Head />` tag or using `styled-jsx`. These should be avoided in `pages/_document.js` as they lead to unexpected behavior

## Customizing `renderPage`

Expand Down

0 comments on commit 969ffd6

Please sign in to comment.