import { useCallback , useRef } from 'react' ; export function useDoubleTap ( interval = 250 ) { const refLastClick = useRef ( 0 ) ; return useCallback ( ( ) => { const date = Date . now ( ) ; const delta = date - refLastClick . current ; refLastClick . current = date ; return ( delta < interval ) ; } , [ ] ) ; }