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:
parent
65a9a63af1
commit
a691dd06cf
30
readme.md
30
readme.md
|
@ -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>`
|
### Custom `<Document>`
|
||||||
|
|
||||||
<p><details>
|
<p><details>
|
||||||
|
|
Loading…
Reference in a new issue