Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
123456789101112131415161718import {useCallback, useRef} from 'react'import {useFocusEffect} from '@react-navigation/native'
export function useRefreshOnFocus<T>(refetch: () => Promise<T>) { const firstTimeRef = useRef(true)
useFocusEffect( useCallback(() => { if (firstTimeRef.current) { firstTimeRef.current = false return }
refetch() }, [refetch]), )}