From 1d6a54fde0bb913c2e7c128d7e5c593bc3da94d0 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 10 Mar 2020 09:46:11 -0700 Subject: [PATCH 1/2] Add missing words --- docs/basic-features/data-fetching.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/basic-features/data-fetching.md b/docs/basic-features/data-fetching.md index c3f5053cd529f5c..53bc8568b2f09d5 100644 --- a/docs/basic-features/data-fetching.md +++ b/docs/basic-features/data-fetching.md @@ -366,7 +366,7 @@ export default Page ### When should I use `getServerSideProps`? -You should use `getServerSideProps` only if you need to pre-render a page whose data must be fetched at request time. Time to first byte (TTFB) will be slower than `getStaticProps` because the server must compute the result on every request, and the result cannot be cached by a CDN without extra . +You should use `getServerSideProps` only if you need to pre-render a page whose data must be fetched at request time. Time to first byte (TTFB) will be slower than `getStaticProps` because the server must compute the result on every request, and the result cannot be cached by a CDN without extra configuration. If you don’t need to pre-render the data, then you should consider fetching data on the client side. [Click here to learn more](#fetching-data-on-the-client-side). @@ -389,7 +389,7 @@ export const getServerSideProps: GetServerSideProps = async context => { `getServerSideProps` only runs on server-side and never runs on the browser. If a page uses `getServerSideProps` , then: - When you request this page directly, `getServerSideProps` runs at the request time, and this page will be pre-rendered with the returned props. -- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)), Next.js sends an API request to server, which runs `getServerSideProps`. It’ll return a JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. +- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)) or `next/router` ([documentation](/docs/api-reference/next/router.md)), Next.js sends an API request to server, which runs `getServerSideProps`. It’ll return a JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. #### Only allowed in a page From d552d515bc6c29bfbed5a5557cbc3cdb2a20a246 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 10 Mar 2020 10:19:26 -0700 Subject: [PATCH 2/2] Update docs/basic-features/data-fetching.md Co-Authored-By: JJ Kasper --- docs/basic-features/data-fetching.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basic-features/data-fetching.md b/docs/basic-features/data-fetching.md index 53bc8568b2f09d5..c080305463a6e79 100644 --- a/docs/basic-features/data-fetching.md +++ b/docs/basic-features/data-fetching.md @@ -389,7 +389,7 @@ export const getServerSideProps: GetServerSideProps = async context => { `getServerSideProps` only runs on server-side and never runs on the browser. If a page uses `getServerSideProps` , then: - When you request this page directly, `getServerSideProps` runs at the request time, and this page will be pre-rendered with the returned props. -- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)) or `next/router` ([documentation](/docs/api-reference/next/router.md)), Next.js sends an API request to server, which runs `getServerSideProps`. It’ll return a JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. +- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)) or `next/router` ([documentation](/docs/api-reference/next/router.md)), Next.js sends an API request to the server, which runs `getServerSideProps`. It’ll return JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. #### Only allowed in a page