Mention Custom App GIP in UPGRADING (#8647)
This tells the user to check their custom <App> for `getInitialProps` if they previously copied the example. This should help them leverage automatic static optimization!
This commit is contained in:
parent
6c01bbd6df
commit
319bc463e7
2 changed files with 28 additions and 1 deletions
27
UPGRADING.md
27
UPGRADING.md
|
@ -10,6 +10,33 @@ Next.js 9's dynamic routes are **automatically configured on [Now](https://zeit.
|
|||
|
||||
You can read more about [Dynamic Routing here](https://github.com/zeit/next.js#dynamic-routing).
|
||||
|
||||
#### Check your Custom <App> (`pages/_app.js`)
|
||||
|
||||
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
|
||||
|
||||
Removing `getInitialProps` from `pages/_app.js` (when possible) is important to leverage new Next.js features!
|
||||
|
||||
The following `getInitialProps` does nothing and may be removed:
|
||||
|
||||
```js
|
||||
class MyApp extends App {
|
||||
// Remove me, I do nothing!
|
||||
static async getInitialProps({ Component, ctx }) {
|
||||
let pageProps = {}
|
||||
|
||||
if (Component.getInitialProps) {
|
||||
pageProps = await Component.getInitialProps(ctx)
|
||||
}
|
||||
|
||||
return { pageProps }
|
||||
}
|
||||
|
||||
render() {
|
||||
// ... etc
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
#### `@zeit/next-typescript` is no longer necessary
|
||||
|
|
|
@ -11,7 +11,7 @@ This causes **all pages** to be executed on the server -- disabling [Automatic P
|
|||
Be sure you meant to use `getInitialProps` in `pages/_app`!
|
||||
There are some valid use cases for this, but it is often better to handle `getInitialProps` on a _per-page_ basis.
|
||||
|
||||
If you copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
|
||||
If you previously copied the [Custom `<App>`](https://nextjs.org/docs#custom-app) example, you may be able to remove your `getInitialProps`.
|
||||
|
||||
The following `getInitialProps` does nothing and may be removed:
|
||||
|
||||
|
|
Loading…
Reference in a new issue