UNPKG

react-healthy

Version:

Incrementally check and alert your users to the health of your APIs

8 lines (5 loc) 409 B
import { useRef, useEffect } from 'react'; const useInterval=(a,b)=>{const c=useRef();// Remember the latest callback. // Set up the interval. useEffect(()=>{c.current=a;},[a]),useEffect(()=>{function a(){var a;null===(a=c.current)||void 0===a?void 0:a.call(c);}if(null!==b){const c=setInterval(a,b);return ()=>clearInterval(c)}},[b]);};var useInterval$1 = useInterval; export { useInterval$1 as default };