A simple mixin for application hotkeys.
Provides a react synthetic event to the named event handler, but only when the component is mounted.
For more info, check out the demo from the example folder.
npm install react-hotkey --save
var hotkey = require('react-hotkey');
// Enable event listening, can be safely called multiple times
hotkey.activate();
React.createClass({
mixins: [hotkey.Mixin('handleHotkey')],
handleHotkey: function(e) {
// receives a React Keyboard Event
// http://facebook.github.io/react/docs/events.html#keyboard-events
}
})This approach was extracted from react-bootstrap.
MIT