var $elementToHighlight = $('#someId');
$(document).on('keydown',function(e){
if(e.keyCode==13){
//enter
$elementToHighlight.addClass('hightlighted');
}
}).on('keyup',function(){
$elementToHighlight.removeClass('hightlighted');
});
handleOnKeyUp() {
this.setState({isPressed: this.state.isPressed})
};
handleOnKeyDown() {
this.setState({isPressed: this.state.isPressed})
};
render(){
var style = classNames({
"pressed-style": this.state.isPressed,
"unpressed-style": !this.state.isPressed
})
return <button className={style}
onKeyUp={this.handleOnKeyUp}
onKeyDown={this.handleOnKeyDown}
>Button</button>;
}