Step 1: Define It In The Constructor
constructor(props) { super(props); this.state = { } this.handleEnterKeyPress = this.handleEnterKeyPress.bind(this) }
step 2: write it to the rendering method
render() { return ( <input className ="pageText" type="text" value= "value" onKeyPress = {this.handleEnterKeyPress} /> ) }
Step 3: write the appropriate function in the class
handleEnterKeyPress(e) { if (e.charCode == 13) {
Ashutosh ranan
source share