1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Update README.md

This commit is contained in:
Guillermo Rauch 2016-12-19 14:41:21 -08:00 committed by GitHub
parent 12ae74c236
commit 660147f661

View file

@ -276,9 +276,7 @@ export default ({ url }) => (
### Custom `<Document>`
Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include `<html>`, `<body>`, etc.
In order to support custom server-rendering pipelines (such as rendering CSS with `styled-components` or `glamor`), you can implement `getInitialProps` at the `<Document>` level:
Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include `<html>`, `<body>`, etc. But we still make it possible to override that:
```jsx
import Document, { Head, Main, NextScript } from `next/document`
@ -306,7 +304,7 @@ export default class MyDocument extends Document {
}
```
The `ctx` object is equivalent to the one received in all [`getInitialProps`](#fetching-data-and-component-lifecycle) hooks, plus:
The `ctx` object is equivalent to the one received in all [`getInitialProps`](#fetching-data-and-component-lifecycle) hooks, with one addition:
- `renderPage` (`Function`) a callback that executes the actual React rendering logic (synchronously). It's useful to decorate this function in order to support server-rendering wrappers like Aphrodite's [`renderStatic`](https://github.com/Khan/aphrodite#server-side-rendering)