Skip to content

Commit

Permalink
Document the need to call App.getInitialProps() from a custom app's g…
Browse files Browse the repository at this point in the history
…etInitialProps (#24002)

Document the need to call App.getInitialProps() from a custom app's getInitialProps. See #23055.
  • Loading branch information
marcvangend authored Apr 16, 2021
1 parent 15133b4 commit b7a1265
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions docs/advanced-features/custom-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The `Component` prop is the active `page`, so whenever you navigate between rout

- If your app is running and you just added a custom `App`, you'll need to restart the development server. Only required if `pages/_app.js` didn't exist before.
- Adding a custom `getInitialProps` in your `App` will disable [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md) in pages without [Static Generation](/docs/basic-features/data-fetching.md#getstaticprops-static-generation).
- When you add `getInitialProps` in your custom app, you must `import App from "next/app"`, call `App.getInitialProps(appContext)` inside `getInitialProps` and merge the returned object into the return value.
- `App` currently does not support Next.js [Data Fetching methods](/docs/basic-features/data-fetching.md) like [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation) or [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering).

### TypeScript
Expand Down

0 comments on commit b7a1265

Please sign in to comment.