import { useEffect } from 'react';
function useEscapeKey(key) {
    return (callBack) => {
        const handleKeyDown = (event) => {
            if (event?.key === key) {
                callBack();
            }
        };
        useEffect(() => {
            document.addEventListener('keydown', handleKeyDown);
            return () => {
                document.removeEventListener('keydown', handleKeyDown);
            };
        }, [key, callBack]);
    };
}
export default useEscapeKey;
//# sourceMappingURL=useEscKeyEvent.js.map