Update README.md

This commit is contained in:
Guillermo Rauch 2016-12-19 14:35:26 -08:00 committed by GitHub
parent 1980726208
commit 59c33e1f11

View file

@ -158,7 +158,7 @@ Notice that to load data when the page loads, we use `getInitialProps` which is
For the initial page load, `getInitialProps` will execute on the server only. `getInitialProps` will only be executed on the client when navigating to a different route via the `Link` component or using the routing APIs.
`getInitialProps` receives a context object with the following properties:
`getInitialProps` <span id="getinitialprops-params">receives</span> a context object with the following properties:
- `pathname` - path section of URL
- `query` - query string section of URL parsed as an object
@ -306,6 +306,10 @@ export default class MyDocument extends Document {
}
```
The `ctx` object is equivalent to the one received in all [`getInitialProps`](#getinitialprops-params) hooks, plus:
- `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)
### Custom error handling
404 or 500 errors are handled both client and server side by a default component `error.js`. If you wish to override it, define a `_error.js`: