Update README.md
This commit is contained in:
parent
07dbf2a20c
commit
c3ae04b69a
1 changed files with 3 additions and 1 deletions
|
@ -106,7 +106,7 @@ export default () => (
|
|||
|
||||
### Component lifecycle
|
||||
|
||||
When you need state, lifecycle hooks or **initial data population** you can export a `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`.
|
||||
When you need state, lifecycle hooks or **initial data population** you can export a `React.Component`.
|
||||
|
||||
```jsx
|
||||
import React from 'react'
|
||||
|
@ -124,6 +124,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`.
|
||||
|
||||
### Routing
|
||||
|
||||
Client-side transitions between routes are enabled via a `<Link>` component
|
||||
|
|
Loading…
Reference in a new issue