const EscapeListen = React.createClass({ handleKeyDown: function(e) { if (e.keyCode === 27) { console.log('You pressed the escape key!') } }, render: function() { return ( <input type='text' onKeyDown={this.handleKeyDown} /> ) } })