Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed backticks on data fetching api titles #33216

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/api-reference/data-fetching/get-server-side-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: API reference for `getServerSideProps`. Learn how to fetch data on each request with Next.js.
---

# `getServerSideProps`
# getServerSideProps

<details>
<summary><b>Version History</b></summary>
Expand Down Expand Up @@ -41,7 +41,7 @@ The `context` parameter is an object containing the following keys:
- `locales` contains all supported locales (if enabled).
- `defaultLocale` contains the configured default locale (if enabled).

## `getServerSideProps` return values
## getServerSideProps return values

The `getServerSideProps` function should return an object with the following **optional** properties:

Expand Down Expand Up @@ -102,7 +102,7 @@ export async function getServerSideProps(context) {
}
```

### `getServerSideProps` with TypeScript
### getServerSideProps with TypeScript

For TypeScript, you can use the `GetServerSideProps` type from `next`:

Expand Down
6 changes: 3 additions & 3 deletions docs/api-reference/data-fetching/get-static-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: API reference for `getStaticPaths`. Learn how to fetch data and generate static pages with `getStaticPaths`.
---

# `getStaticPaths`
# getStaticPaths

<details>
<summary><b>Version History</b></summary>
Expand All @@ -27,7 +27,7 @@ export async function getStaticPaths() {
}
```

## `getStaticPaths` return values
## getStaticPaths return values

The `getStaticPaths` function should return an object with the following **required** properties:

Expand Down Expand Up @@ -199,7 +199,7 @@ export async function getStaticProps({ params }) {
export default Post
```

## `getStaticProps` with TypeScript
## getStaticProps with TypeScript

For TypeScript, you can use the `GetStaticPaths` type from `next`:

Expand Down
6 changes: 3 additions & 3 deletions docs/api-reference/data-fetching/get-static-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: API reference for `getStaticProps`. Learn how to use `getStaticProps` to generate static pages with Next.js.
---

# `getStaticProps`
# getStaticProps

<details>
<summary><b>Version History</b></summary>
Expand Down Expand Up @@ -39,7 +39,7 @@ The `context` parameter is an object containing the following keys:
- `locales` contains all supported locales (if enabled).
- `defaultLocale` contains the configured default locale (if enabled).

## `getStaticProps` return values
## getStaticProps return values

The `getStaticProps` function should return an object with the following **optional** properties:

Expand Down Expand Up @@ -192,7 +192,7 @@ export async function getStaticProps() {
export default Blog
```

## `getStaticProps` with TypeScript
## getStaticProps with TypeScript

You can use the `GetStaticProps` type from `next` to type the function:

Expand Down
8 changes: 4 additions & 4 deletions docs/basic-features/data-fetching/get-server-side-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Fetch data on each request with `getServerSideProps`.
---

# `getServerSideProps`
# getServerSideProps

If you export a function called `getServerSideProps` (Server-Side Rendering) from a page, Next.js will pre-render this page on each request using the data returned by `getServerSideProps`.

Expand All @@ -14,7 +14,7 @@ export async function getServerSideProps(context) {
}
```

## When does `getServerSideProps` run
## When does getServerSideProps run

`getServerSideProps` only runs on server-side and never runs on the browser. If a page uses `getServerSideProps`, then:

Expand All @@ -37,7 +37,7 @@ You should use `getServerSideProps` only if you need to pre-render a page whose

If you do not need to pre-render the data, then you should consider fetching data on the [client side](#fetching-data-on-the-client-side).

### `getServerSideProps` or API Routes
### getServerSideProps or API Routes

It can be tempting to reach for an [API Route](/docs/api-routes/introduction.md) when you want to fetch data from the server, then call that API route from `getServerSideProps`. This is an unnecessary and inefficient approach, as it will cause an extra request to be made due to both `getServerSideProps` and API Routes running on the server.

Expand All @@ -52,7 +52,7 @@ If your page contains frequently updating data, and you don’t need to pre-rend

This approach works well for user dashboard pages, for example. Because a dashboard is a private, user-specific page, SEO is not relevant and the page doesn’t need to be pre-rendered. The data is frequently updated, which requires request-time data fetching.

## Using `getServerSideProps` to fetch data at request time
## Using getServerSideProps to fetch data at request time

The following example shows how to fetch data at request time and pre-render the result.

Expand Down
8 changes: 4 additions & 4 deletions docs/basic-features/data-fetching/get-static-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Fetch data and generate static pages with `getStaticProps`. Learn more about this API for data fetching in Next.js.
---

# `getStaticPaths`
# getStaticPaths

If a page has [Dynamic Routes](/docs/routing/dynamic-routes.md) and uses `getStaticProps`, it needs to define a list of paths to be statically generated.

Expand All @@ -23,7 +23,7 @@ Note that`getStaticProps` **must** be used with `getStaticPaths`, and that you *

The [`getStaticPaths` API reference](/docs/api-reference/data-fetching/get-static-paths.md) covers all parameters and props that can be used with `getStaticPaths`.

## When should I use `getStaticPaths`?
## When should I use getStaticPaths?

You should use `getStaticPaths` if you’re statically pre-rendering pages that use dynamic routes and:

Expand All @@ -33,11 +33,11 @@ You should use `getStaticPaths` if you’re statically pre-rendering pages that
- The data can be publicly cached (not user-specific)
- The page must be pre-rendered (for SEO) and be very fast — `getStaticProps` generates `HTML` and `JSON` files, both of which can be cached by a CDN for performance

## When does `getStaticPaths` run
## When does getStaticPaths run

`getStaticPaths` only runs at build time on server-side. If you're using [Incremental Static Regeneration](/docs/basic-features/data-fetching/incremental-static-regeneration.md), `getStaticPaths` can also be run on-demand _in the background_, but still only on the server-side.

## Where can I use `getStaticPaths`
## Where can I use getStaticPaths

`getStaticPaths` can only be exported from a **page**. You **cannot** export it from non-page files.

Expand Down
8 changes: 4 additions & 4 deletions docs/basic-features/data-fetching/get-static-props.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Fetch data and generate static pages with `getStaticProps`. Learn more about this API for data fetching in Next.js.
---

# `getStaticProps`
# getStaticProps

If you export a function called `getStaticProps` (Static Site Generation) from a page, Next.js will pre-render this page at build time using the props returned by `getStaticProps`.

Expand All @@ -14,7 +14,7 @@ export async function getStaticProps(context) {
}
```

## When should I use `getStaticProps`?
## When should I use getStaticProps?

You should use `getStaticProps` if:

Expand All @@ -25,7 +25,7 @@ You should use `getStaticProps` if:

Because `getStaticProps` runs at build time, it does **not** receive data that’s only available during request time, such as query parameters or `HTTP` headers, as it generates static `HTML`. When combined with [Incremental Static Regeneration](/docs/basic-features/data-fetching/incremental-static-regeneration.md) however, it will run in the background while the stale page is being revalidated, and the fresh page served to the browser.

## Using `getStaticProps` to fetch data from a CMS
## Using getStaticProps to fetch data from a CMS

The following example shows how you can fetch a list of blog posts from a CMS.

Expand Down Expand Up @@ -84,7 +84,7 @@ This JSON file will be used in client-side routing through [`next/link`](/docs/a

When using Incremental Static Generation `getStaticProps` will be executed out of band to generate the JSON needed for client-side navigation. You may see this in the form of multiple requests being made for the same page, however, this is intended and has no impact on end-user performance

## Where can I use `getStaticProps`
## Where can I use getStaticProps

`getStaticProps` can only be exported from a **page**. You **cannot** export it from non-page files.

Expand Down