Commit d8cf0ba7 authored by Tim Oxley's avatar Tim Oxley Committed by GitHub

Readme: Explain where & when getInitialProps executes

parent c4d62610
...@@ -128,6 +128,8 @@ export default class extends React.Component { ...@@ -128,6 +128,8 @@ export default class extends React.Component {
Notice that to load data when the page loads, we use `getInitialProps` which is an [`async`](https://zeit.co/blog/async-and-await) static method. It can asynchronously fetch anything that resolves to a JavaScript plain `Object`, which populates `props`. Notice that to load data when the page loads, we use `getInitialProps` which is an [`async`](https://zeit.co/blog/async-and-await) static method. It can asynchronously fetch anything that resolves to a JavaScript plain `Object`, which populates `props`.
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 `props.url.pushTo` API.
### Routing ### Routing
Client-side transitions between routes are enabled via a `<Link>` component Client-side transitions between routes are enabled via a `<Link>` component
......
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