title: How to submit a form using Enter key in react.js?
body: <p>Here is my form and the onClick method. I would like to execute this method when the Enter button of keyboard is pressed. How ?</p>
  <p>N.B: <em>No jquery is appreciated.</em></p>
  <pre><code>comment: function (e) {
    e.preventDefault();
    this.props.comment({
      comment: this.refs.text.getDOMNode().value,
      userPostId:this.refs.userPostId.getDOMNode().value,
    })
  },
  
  
  &lt;form className=&quot;commentForm&quot;&gt;
    &lt;textarea rows=&quot;2&quot; cols=&quot;110&quot; placeholder=&quot;****Comment Here****&quot; ref=&quot;text&quot;  /&gt;&lt;br /&gt;
    &lt;input type=&quot;text&quot; placeholder=&quot;userPostId&quot; ref=&quot;userPostId&quot; /&gt; &lt;br /&gt;
    &lt;button type=&quot;button&quot; className=&quot;btn btn-success&quot; onClick={this.comment}&gt;Comment&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>