Skip to content

Commit 66a6c23

Browse files
Fix the re-render warning for using useIsFocused (#1299)
* fixes the re-render warning for using useIsFocused It re-renders the direct component that contains this hook, but it was mentioned that it re-renders the screen. * updates use-is-focused.md for v7.x * updates use-is-focused.md for v6.x * Update versioned_docs/version-6.x/use-is-focused.md Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com> * Update use-is-focused.md for v7.x --------- Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
1 parent 998db24 commit 66a6c23

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

versioned_docs/version-6.x/use-is-focused.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function Profile() {
2020
}
2121
```
2222

23-
Note that using this hook triggers a re-render for the screen when it changes focus. This might cause lags during the animation if your screen is heavy. You might want to extract the expensive parts to separate components and use [`React.memo`](https://reactjs.org/docs/react-api.html#reactmemo) or [`React.PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent) to minimize re-renders for them.
23+
Note that using this hook triggers a re-render for the component when the screen it's in changes focus. This might cause lags during the animation if your component is heavy. You might want to extract the expensive parts to separate components and use [`React.memo`](https://reactjs.org/docs/react-api.html#reactmemo) or [`React.PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent) to minimize re-renders for them.
2424

2525
## Using with class component
2626

versioned_docs/version-7.x/use-is-focused.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function Profile() {
2020
}
2121
```
2222

23-
Note that using this hook triggers a re-render for the screen when it changes focus. This might cause lags during the animation if your screen is heavy. You might want to extract the expensive parts to separate components and use [`React.memo`](https://reactjs.org/docs/react-api.html#reactmemo) or [`React.PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent) to minimize re-renders for them.
23+
Note that using this hook triggers a re-render for the component when the screen it's in changes focus. This might cause lags during the animation if your component is heavy. You might want to extract the expensive parts to separate components and use [`React.memo`](https://reactjs.org/docs/react-api.html#reactmemo) or [`React.PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent) to minimize re-renders for them.
2424

2525
## Using with class component
2626

0 commit comments

Comments
 (0)