Commit 660147f6 authored by Guillermo Rauch's avatar Guillermo Rauch Committed by GitHub

Update README.md

parent 12ae74c2
...@@ -276,9 +276,7 @@ export default ({ url }) => ( ...@@ -276,9 +276,7 @@ export default ({ url }) => (
### Custom `<Document>` ### Custom `<Document>`
Pages in `Next.js` skip the definition of the surrounding document's markup. For example, you never include `<html>`, `<body>`, etc. 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:
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:
```jsx ```jsx
import Document, { Head, Main, NextScript } from `next/document` import Document, { Head, Main, NextScript } from `next/document`
...@@ -306,7 +304,7 @@ export default class MyDocument extends 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) - `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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment