Skip to content

Commit fd9cd8f

Browse files
halileohalileisatya164
authored andcommitted
Correct example code for useNavigationState
1 parent 3e3e82c commit fd9cd8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/use-navigation-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ sidebar_label: useNavigationState
99
It takes a selector function as an argument. The selector will receive the full navigation state and can return a specific value from the state:
1010

1111
```js
12-
const index = useNavigation(state => state.index);
12+
const index = useNavigationState(state => state.index);
1313
```
1414

1515
The selector function helps to reduce unnecessary re-renders, so your screen will re-render only when that's something you care about. If you actually need the whole state object, you can do this explicitly:
1616

1717
```js
18-
const state = useNavigation(state => state);
18+
const state = useNavigationState(state => state);
1919
```
2020

2121
> Note: This hook is useful for advanced cases and it's easy to introduce performance issues if you're not careful. For most of the cases, you don't need the navigator's state.

0 commit comments

Comments
 (0)