You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This removes support for `preserveScrollPosition` due to its unforunate naming.
Instead, we introduce three scrolling strategies:
* `none`: Router doesn't scroll the window when routes change
* `scrollToTop` (default): Router always scrolls to top when routes change
* `imitateBrowser`: Router tries to act like browser acts with server-rendered pages: it scrolls to top when clicking on links, but tries to restore position when navigating back and forward
You can only specify these on <Routes />.
Per-route overrides are not supported, but you can supply a custom strategy object.
This also fixes#252.
Migration path:
The default changed from what corresponded to `imitateBrowser`, to `scrollToTop`.
If router's server-rendered scrolling imitation worked well for you, you must now specify it explicitly:
```
// before
<Routes>
<Routes preserveScrollPosition={false}>
// after
<Routes scrollStrategy='imitateBrowser'>
```
If you wish router to not try to manage scrolling, you must opt out:
```
// before
<Routes preserveScrollPosition={true}>
// after
<Routes scrollStrategy='none'>
```
Also, as a third option, you may now use the simple `scrollToTop` strategy.
0 commit comments