Similar to React useEffect
, but only runs when the current route is focused. This is directly based off React Navigation's useFocusEffect.
You should pass it a function that is wrapped in a useCallback to avoid running it every render.
Example:
Edit this page on GitHub.