Skip to content

Commit 2b761a9

Browse files
authored
docs(router.md) Add note about page state and navigation (#26320)
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: #26270
1 parent ad5e9bd commit 2b761a9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/api-reference/next/router.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export default function Page() {
112112
}
113113
```
114114

115+
> **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`.
116+
115117
Redirecting the user to `pages/login.js`, useful for pages behind [authentication](/docs/authentication):
116118

117119
```jsx

0 commit comments

Comments
 (0)