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

State is no longer used since #4156

This commit is contained in:
Tim Neutkens 2018-04-18 21:39:57 +02:00
parent 65a9a63af1
commit a691dd06cf

View file

@ -990,36 +990,6 @@ export default class MyApp extends App {
}
```
When using state inside app the `hasError` property has to be defined:
```js
import App, {Container} from 'next/app'
import React from 'react'
export default class MyApp extends App {
static async getInitialProps ({ Component, router, ctx }) {
let pageProps = {}
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx)
}
return {pageProps}
}
state = {
hasError: null
}
render () {
const {Component, pageProps} = this.props
return <Container>
<Component {...pageProps} />
</Container>
}
}
```
### Custom `<Document>`
<p><details>