Unverified Commit 7d59da97 authored by Jono Hewitt's avatar Jono Hewitt Committed by GitHub

Update `router.prefetch` documentation to include `locale` option (#39442)

* Update `router.prefetch` documentation

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

* apply suggestions
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent a6bc3879
...@@ -248,14 +248,16 @@ export default function Page() { ...@@ -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. 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 ```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]`) - `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 - `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 #### Usage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment