2018-12-26 23:30:16 +01:00
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
export default class InstanceInitialPropsPage extends React.Component {
|
2019-11-11 04:24:53 +01:00
|
|
|
async getInitialProps() {
|
2018-12-26 23:30:16 +01:00
|
|
|
return fetchData()
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
render() {
|
2018-12-26 23:30:16 +01:00
|
|
|
return <p>{this.props.name}</p>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
function fetchData() {
|
2018-12-26 23:30:16 +01:00
|
|
|
const p = new Promise(resolve => {
|
|
|
|
setTimeout(() => resolve({ name: 'Anderson Leite' }), 10)
|
|
|
|
})
|
|
|
|
return p
|
|
|
|
}
|