ReactJS - Is there a way to trigger a method by pressing the 'Enter' key inside <input/>?
<p>Using only <code>onChange</code> and value and while focused inside a <code>&lt;input/&gt;</code>, preferably without jQuery, is there a way to trigger a method by pressing the 'Enter' key? Because, would only want the user to press 'Enter' key in order to update the <code>name</code> string state.</p>

<p>Here is the code:</p>

<pre><code>  constructor(props) {
    super(props);

    this.state = {
      name: '',
    }
  }

  textChange(event) {
    this.setState({
      name: event.target.value,
    })
  }

  //Would like to trigger this once 'Enter' key is pressed while focused inside `&lt;input/&gt;`
  enterPressed() {
    var name = this.state.name;
  }

  render() {
    return (
        &lt;input
          placeholder='Enter name'
          onChange={this.textChange.bind(this)}
          value={this.state.name}
        /&gt;
    )
  }
</code></pre>