From b13892e0070993e4d014a70f6b424302fe583635 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Fri, 6 Mar 2020 03:12:46 -0800 Subject: [PATCH] Add TypeScript docs for SSG (#10865) * Add TypeScript docs * Fix types --- .../data-fetching/getInitialProps.md | 54 +++++++++++++++++++ docs/basic-features/data-fetching.md | 36 +++++++++++++ docs/basic-features/typescript.md | 48 +++++------------ 3 files changed, 102 insertions(+), 36 deletions(-) diff --git a/docs/api-reference/data-fetching/getInitialProps.md b/docs/api-reference/data-fetching/getInitialProps.md index 710bdc772596515..0ef43956d60711b 100644 --- a/docs/api-reference/data-fetching/getInitialProps.md +++ b/docs/api-reference/data-fetching/getInitialProps.md @@ -4,6 +4,14 @@ description: Enable Server-Side Rendering in a page and do initial data populati # getInitialProps +## Recommended: Use `getStaticProps` or `getServerSideProps` instead + +If you're using Next.js 9.3 or newer, you should use `getStaticProps` or `getServerSideProps` instead of `getInitialProps`. + +Learn more on the [Pages documentation](/docs/basic-features/pages.md) and the [Data fetching documentation](/docs/basic-features/data-fetching.md): + +## `getInitialProps` (for older versions of Next.js) +
Examples