import useEventListener , { UseEventOptions } from './useEventListener' ; const escapeKeyCode = 27 ; const handleEscape = ( e , callback ) => { if ( e . keyCode === escapeKeyCode ) { e . stopImmediatePropagation ( ) ; callback ( ) ; } } ; param callback param options param options . options param options . enabled param options . dependencies param options . element const useEscapeKey = ( callback , options ? ) => { return useEventListener ( 'keydown' , e => handleEscape ( e , callback ) , options ) ; } ; export default useEscapeKey ;