react-keydown
react-keydown copied to clipboard
Feature request: add @keyup and @keyupScoped decorators
In my use case, I’d like to be able to toggle state based on if a modifier key is pressed, so it would be great to be able to do something like:
class MyComponent extends React.Component {
@keydown('alt')
setModeCopy(event) {
this.setState({ mode: 'copy' });
}
@keyup('alt')
setModeMove(event) {
this.setState({ mode: 'move' });
}
}
In actually use, I think I would use @keydownScoped and @keyupScoped.
I could easily handle disabling key-repeat #30 with this feature.