Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-close-on-escape

conorhastings14.2kMIT3.0.0TypeScript support: definitely-typed

close react component on press escape

react, escape, close, higher-order-component, hoc

readme

React Close On Escape

Simple HOC to close enclosed react component on press of escape key (or really call on any function but please use for closing thank you)

use

npm install react-close-on-escape --save

import CloseOnEscape from 'react-close-on-escape';

const Component = ({ onEscape }) => <CloseOnEscape onEscape={onEscape}><span>some stuff here</span></CloseOnEscape>;

:wave: