From 7b008261ce334a3018ad403cbda3e2d25a2c6eb4 Mon Sep 17 00:00:00 2001 From: Mike Jerome Date: Wed, 17 Feb 2021 15:51:53 +0000 Subject: [PATCH] Document `scroll` option for router.push Clarify in the docs that `scroll` is an option for router.push() and it defaults to true. --- docs/api-reference/next/router.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/api-reference/next/router.md b/docs/api-reference/next/router.md index 7b65b5273983d..7d476b777c67b 100644 --- a/docs/api-reference/next/router.md +++ b/docs/api-reference/next/router.md @@ -71,6 +71,7 @@ router.push(url, as, options) - `url` - The URL to navigate to - `as` - Optional decorator for the URL that will be shown in the browser. Before Next.js 9.5.3 this was used for 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 configuration options: + - `scroll`: Scroll to the top of the page after a navigation. Defaults to `true` - [`shallow`](/docs/routing/shallow-routing.md): Update the path of the current page without rerunning [`getStaticProps`](/docs/basic-features/data-fetching.md#getstaticprops-static-generation), [`getServerSideProps`](/docs/basic-features/data-fetching.md#getserversideprops-server-side-rendering) or [`getInitialProps`](/docs/api-reference/data-fetching/getInitialProps.md). Defaults to `false` > You don't need to use `router.push` for external URLs. [window.location](https://developer.mozilla.org/en-US/docs/Web/API/Window/location) is better suited for those cases.