react-listener
v0.0.2
Published
A component that adds and removes event listeners.
Downloads
13
Readme
react-listener
A component that adds and removes event listeners.
Usage
import Listener from "react-listener"
const MyComponent = () =>
<Listener
eventName="keydown"
callback={() => event.keyCode === 27 && event.preventDefault && console.log("esc pressed")}
>
<div>
This component will log every time escape is pressed.
</div>
</Listener>