on enter key press react
onKeyPress={(e) => e.key === 'Enter' && handleSearch()}var Input = React.createClass({
render: function () {
return <input type="text" onKeyDown={this._handleKeyDown} />;
},
_handleKeyDown: function(e) {
if (e.key === 'Enter') {
console.log('do validate');
}
}
});
const Enter = () => {
const handle = () => console.log('Enter pressed');
return <input type="text" onKeyDown={e => e.key === 'Enter' && handle} />;
};
Also in JavaScript:
- how to set three js canvas width 100%
- check if anagram
- js random minus
- simple json data
- reactjs fix ios apostrophe encoding
- online javascript compiler
- js database connection
- js math random
- jQuery exclude exteranl link for images
- react native image fit container
- JSX not allowed in files with extension '.js'
- quick sort in javascript
- jquery AND operation
- javascript sum of number in object array
- js get date in ms
- get day js
- javascript minute and second to convert seconds
- js loop ul
- javascript random()
- document ready js
- jquery get next element
- port already in use node js
- fetch is not defined amazon-cognito-identity-js
- edit json via nodejs