Unverified Commit 319bc463 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

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!
parent 6c01bbd6
...@@ -10,6 +10,33 @@ Next.js 9's dynamic routes are **automatically configured on [Now](https://zeit. ...@@ -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). 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 ## Breaking Changes
#### `@zeit/next-typescript` is no longer necessary #### `@zeit/next-typescript` is no longer necessary
......
...@@ -11,7 +11,7 @@ This causes **all pages** to be executed on the server -- disabling [Automatic P ...@@ -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`! 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. 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: The following `getInitialProps` does nothing and may be removed:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment