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