import * as React from 'react' ; type SimpleCallback = ( ) => void ; /**
 * `useInterval()` hook stolen from Dan's blog:
 * https://overreacted.io/making-setinterval-declarative-with-react-hooks/
 */ export function useInterval ( callback , delay = 1000 ) { const savedCallback = React . useRef < SimpleCallback > ( ) ; React . useEffect ( ( ) => { savedCallback . current = callback ; } , [ callback ] ) ; React . useEffect ( ( ) => { function tick ( ) { if ( savedCallback . current ) { savedCallback . current ( ) ; } } const id = setInterval ( tick , delay ) ; return ( ) => clearInterval ( id ) ; } , [ delay ] ) ; }