From 7d59da97aceadd8754156b91bc01ca0387848125 Mon Sep 17 00:00:00 2001 From: Jono Hewitt <47791294+jonohewitt@users.noreply.github.com> Date: Wed, 10 Aug 2022 04:02:55 +0200 Subject: [PATCH] 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: JJ Kasper --- docs/api-reference/next/router.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api-reference/next/router.md b/docs/api-reference/next/router.md index f9f3ac0e602a..e068a85e479a 100644 --- a/docs/api-reference/next/router.md +++ b/docs/api-reference/next/router.md @@ -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