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

Readme: Explain where & when getInitialProps executes

This commit is contained in:
Tim Oxley 2016-11-02 13:42:06 -07:00 committed by GitHub
parent c4d626108e
commit d8cf0ba7c4

View file

@ -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`.
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
Client-side transitions between routes are enabled via a `<Link>` component