Skip to content

Commit 74e187a

Browse files
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.
1 parent 998db24 commit 74e187a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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 the `useIsFocused` in a component triggers a re-render on that component when the focus is changed for the screen that contains the component. 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)