Skip to content

Commit

Permalink
Update router.prefetch documentation to include locale option (#3…
Browse files Browse the repository at this point in the history
…9442)

* Update `router.prefetch` documentation

Include documentation for setting the locale as an option within `router.prefetch`.

* apply suggestions

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
jonohewitt and ijjk committed Aug 10, 2022
1 parent a6bc387 commit 7d59da9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/api-reference/next/router.md
Expand Up @@ -248,14 +248,16 @@ export default function Page() {

Prefetch pages for faster client-side transitions. This method is only useful for navigations without [`next/link`](/docs/api-reference/next/link.md), as `next/link` takes care of prefetching pages automatically.

> This is a production only feature. Next.js doesn't prefetch pages on development.
> This is a production only feature. Next.js doesn't prefetch pages in development.
```jsx
router.prefetch(url, as)
router.prefetch(url, as, options)
```

- `url` - The URL to prefetch, including explicit routes (e.g. `/dashboard`) and dynamic routes (e.g. `/product/[id]`)
- `as` - Optional decorator for `url`. Before Next.js 9.5.3 this was used to prefetch dynamic routes, check our [previous docs](https://nextjs.org/docs/tag/v9.5.2/api-reference/next/link#dynamic-routes) to see how it worked
- `options` - Optional object with the following allowed fields:
- `locale` - allows providing a different locale from the active one. If `false`, `url` has to include the locale as the active locale won't be used.

#### Usage

Expand Down

0 comments on commit 7d59da9

Please sign in to comment.