mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add note about _document being only server side
This commit is contained in:
parent
a6af11c6ae
commit
e1a0f18a92
|
@ -900,6 +900,9 @@ export default () => <HelloBundle title="Dynamic Bundle" />
|
||||||
Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include `<html>`, `<body>`, etc. To override that default behavior, you must create a file at `./pages/_document.js`, where you can extend the `Document` class:
|
Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include `<html>`, `<body>`, etc. To override that default behavior, you must create a file at `./pages/_document.js`, where you can extend the `Document` class:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
|
// _document is only rendered on the server side and not on the client side
|
||||||
|
// Event handlers like onClick can't be added to this file
|
||||||
|
|
||||||
// ./pages/_document.js
|
// ./pages/_document.js
|
||||||
import Document, { Head, Main, NextScript } from 'next/document'
|
import Document, { Head, Main, NextScript } from 'next/document'
|
||||||
import flush from 'styled-jsx/server'
|
import flush from 'styled-jsx/server'
|
||||||
|
|
Loading…
Reference in a new issue