Skip to content

Commit

Permalink
Update use-router.mdx (#57273)
Browse files Browse the repository at this point in the history
Minor tweak to the wording of this section to better convey the behavior
of `scroll: false`.

"Restoration" can be interpreted as reinstating a previously saved
scroll position for that route (as it happens when using
`router.back()`), while what it actually does is preserving the current
scroll position when navigating to a new route, by means of disabling
the default "scroll to top" behavior.

Related to: #57258, and
#47781 (reply in thread)

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
alessiomaffeis and ijjk committed Sep 24, 2024
1 parent 14f7018 commit fb1659a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/02-app/02-api-reference/04-functions/use-router.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default function Layout({ children }) {

> **Good to know**: `<NavigationEvents>` is wrapped in a [`Suspense` boundary](/docs/app/building-your-application/routing/loading-ui-and-streaming#example) because[`useSearchParams()`](/docs/app/api-reference/functions/use-search-params) causes client-side rendering up to the closest `Suspense` boundary during [static rendering](/docs/app/building-your-application/rendering/server-components#static-rendering-default). [Learn more](/docs/app/api-reference/functions/use-search-params#behavior).
### Disabling scroll restoration
### Disabling scroll to top

By default, Next.js will scroll to the top of the page when navigating to a new route. You can disable this behavior by passing `scroll: false` to `router.push()` or `router.replace()`.

Expand Down

0 comments on commit fb1659a

Please sign in to comment.