import { useEffect , useMemo } from "react" ; import { useLocation } from "react-router-dom" ; export function usePolling ( doFn , interval ) { useEffect ( ( ) => { doFn ( ) ; const id = setInterval ( doFn , interval * 1000 ) ; return ( ) => clearInterval ( id ) ; } , [ interval , doFn ] ) ; } export function useQuery ( ) { const { search } = useLocation ( ) ; return useMemo ( ( ) => new URLSearchParams ( search ) , [ search ] ) ; }