Skip to content

Commit d8cf0ba

Browse files
authored
Readme: Explain where & when getInitialProps executes
1 parent c4d6261 commit d8cf0ba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ export default class extends React.Component {
128128

129129
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`.
130130

131+
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.
132+
131133
### Routing
132134

133135
Client-side transitions between routes are enabled via a `<Link>` component

0 commit comments

Comments
 (0)