Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
docs(router.md) Add note about page state and navigation (vercel#26320)
Browse files Browse the repository at this point in the history
This adds a note to the router doc explaining that page state is not reset by default when updating the URL but staying on the same page as this has come up in a few issues. 


## Documentation / Examples

- [x] Make sure the linting passes

x-ref: vercel#26270
  • Loading branch information
ijjk authored Jun 21, 2021
1 parent bf949b3 commit fb483a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/api-reference/next/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ export default function Page() {
}
```

> **Note:** When navigating to the same page in Next.js, the page's state **will not** be reset by default, as the top-level React component is the same. You can manually ensure the state is updated using `useEffect`.
Redirecting the user to `pages/login.js`, useful for pages behind [authentication](/docs/authentication):

```jsx
Expand Down

0 comments on commit fb483a7

Please sign in to comment.