import type { KeyboardEvent } from 'react' ; import { KeyboardKeys } from '../../types' ; function useActionOnEscape ( callback ) { const onKeyDown = ( event ) => { if ( event . key === KeyboardKeys . Escape ) { callback ( ) ; } } ; return { onKeyDown , } ; } export default useActionOnEscape ;