import { useEffect } from 'react' ; function useEventListener ( event , handler , deps = [ ] ) { useEffect ( ( ) => { window . addEventListener ( event , handler ) ; return ( ) => window . removeEventListener ( event , handler ) ; } , [ event , handler , ... deps ] ) ; } export default useEventListener ;