Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix ScrollRestoration getKey example #9266

Merged
merged 3 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions contributors.yml
Expand Up @@ -104,3 +104,4 @@
- xavier-lc
- xcsnowcity
- yuleicul
- GraxMonzo
6 changes: 3 additions & 3 deletions docs/components/scroll-restoration.md
Expand Up @@ -28,7 +28,7 @@ Optional prop that defines the key React Router should use to restore scroll pos

```tsx
<ScrollRestoration
getKey={({ location, matches }) => {
getKey={(location, matches) => {
// default behavior
return location.key;
}}
Expand Down Expand Up @@ -58,7 +58,7 @@ A solid product decision here is to keep the users scroll position on the home f

```tsx
<ScrollRestoration
getKey={({ location, matches }) => {
getKey={(location, matches) => {
return location.pathname;
}}
/>
Expand All @@ -68,7 +68,7 @@ Or you may want to only use the pathname for some paths, and use the normal beha

```tsx
<ScrollRestoration
getKey={({ location, matches }) => {
getKey={(location, matches) => {
const paths = ["/home", "/notifications"];
return paths.includes(location.pathname)
? // home and notifications restore by pathname
Expand Down