Skip to content

Commit 4475b56

Browse files
Update useNavigate docs for state property (#10984)
Co-authored-by: Ashutosh Kumar <[email protected]>
1 parent b386dc7 commit 4475b56

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- arka1002
2323
- arnassavickas
2424
- aroyan
25+
- ashusnapx
2526
- avipatel97
2627
- awreese
2728
- aymanemadidi

docs/hooks/use-navigate.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ Specifying `replace: true` will cause the navigation to replace the current entr
5858

5959
## `options.state`
6060

61-
You may include an optional state value in to store in [history state][history-state]
61+
You may include an optional `state` value to store in [history state][history-state], which you can then access on the destination route via [`useLocation`][use-location]. For example:
62+
63+
```tsx
64+
navigate("/new-route", { state: { key: "value" } });
65+
```
6266

6367
## `options.preventScrollReset`
6468

@@ -99,6 +103,7 @@ The `unstable_viewTransition` option enables a [View Transition][view-transition
99103
[actions]: ../route/action
100104
[history-state]: https://developer.mozilla.org/en-US/docs/Web/API/History/state
101105
[scrollrestoration]: ../components/scroll-restoration
106+
[use-location]: ../hooks/use-location
102107
[use-view-transition-state]: ../hooks//use-view-transition-state
103108
[view-transitions]: https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API
104109
[picking-a-router]: ../routers/picking-a-router

0 commit comments

Comments
 (0)