diff --git a/docs/advanced-features/custom-app.md b/docs/advanced-features/custom-app.md index df41c6f12adb942..1eba8e6fec1c714 100644 --- a/docs/advanced-features/custom-app.md +++ b/docs/advanced-features/custom-app.md @@ -10,6 +10,7 @@ Next.js uses the `App` component to initialize pages. You can override it and co - Keeping state when navigating pages - Custom error handling using `componentDidCatch` - Inject additional data into pages +- [Add global CSS](/docs/basic-features/built-in-css-support#adding-a-global-stylesheet) To override the default `App`, create the file `./pages/_app.js` as shown below: @@ -41,6 +42,10 @@ The `Component` prop is the active `page`, so whenever you navigate between rout > Adding a custom `getInitialProps` in your `App` will disable [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md). +### TypeScript + +If you’re using TypeScript, take a look at [our TypeScript documentation](/docs/basic-features/typescript#custom-app). + ## Related For more information on what to do next, we recommend the following sections: diff --git a/docs/basic-features/typescript.md b/docs/basic-features/typescript.md index f0f9a6d4700c70c..6abba785392c211 100644 --- a/docs/basic-features/typescript.md +++ b/docs/basic-features/typescript.md @@ -118,3 +118,17 @@ export default (req: NextApiRequest, res: NextApiResponse) => { res.status(200).json({ name: 'John Doe' }) } ``` + +## Custom `App` + +If you have a [custom `App` ](/docs/advanced-features/custom-app), you can use the built-in type `AppProps`, like so: + +```ts +import { AppProps } from 'next/app' + +function MyApp({ Component, pageProps }: AppProps) { + return +} + +export default MyApp +```