react on key enter code example
Example 1: use enter key unity
if (Input.GetKey(KeyCode.Return))
Example 2: on enter key press react
onKeyPress={(e) => e.key === 'Enter' && handleSearch()}
Example 3: react detect enter key
var Input = React.createClass({
render: function () {
return <input type="text" onKeyDown={this._handleKeyDown} />;
},
_handleKeyDown: function(e) {
if (e.key === 'Enter') {
console.log('do validate');
}
}
});
Example 4: winforms how to check for enter key
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckEnterKeyPress);