import useSWR from 'swr'; import fetcher from './fetchJSON'; const PeriodicFetch = ( url: string, refreshInterval = 5000, ): GetResponses => { const { data, error } = useSWR(url, fetcher, { refreshInterval, }); return { data, isLoading: !error && !data, isError: error, }; }; export default PeriodicFetch;