From 969ffd6c1a1109f83868bce4f88c8f03541db4d7 Mon Sep 17 00:00:00 2001 From: Vass Bence <49574140+vassbence@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:38:29 +0200 Subject: [PATCH] Mention and styled-jsx caveats in Document's docs (#11499) * Mention <title> and styled-jsx caveats * Update custom-document.md Co-authored-by: Tim Neutkens <tim@timneutkens.nl> --- docs/advanced-features/custom-document.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/advanced-features/custom-document.md b/docs/advanced-features/custom-document.md index 8af080e719d69..f1f8aa3348abc 100644 --- a/docs/advanced-features/custom-document.md +++ b/docs/advanced-features/custom-document.md @@ -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`