Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react keydown event listener

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} />
    )
  }
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #keydown #event #listener
ADD COMMENT
Topic
Name
5+4 =