Skip to content

Commit 85738c3

Browse files
authored
Update use-focus-effect.md (react-navigation#963)
Added explanation of what the cleanup function is and how the user creates it.
1 parent 93171f6 commit 85738c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

versioned_docs/version-5.x/use-focus-effect.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The `useFocusEffect` is analogous to React's `useEffect` hook. The only differen
3434

3535
The effect will run whenever the dependencies passed to `React.useCallback` change, i.e. it'll run on initial render (if the screen is focused) as well as on subsequent renders if the dependencies have changed. If you don't wrap your effect in `React.useCallback`, the effect will run every render if the screen is focused.
3636

37-
The cleanup function runs when the previous effect needs to be cleaned up, i.e. when dependencies change and a new effect is scheduled and when the screen unmounts or blurs.
37+
The code passed to `useFocusEffect` can return a cleanup function that runs when the previous effect needs to be cleaned up, i.e. when dependencies change and a new effect is scheduled and when the screen unmounts or blurs.
3838

3939
## Running asynchronous effects
4040

0 commit comments

Comments
 (0)