title: Submit a form when enter is pressed in a textarea in React?
body: <p>How can I make a form submit when a user pressed <kbd>Enter</kbd> in a <code>&lt;textarea&gt;</code>? The default behaviour is to insert a linebreak into the <code>&lt;textarea&gt;</code>.</p>
  
  <pre><code>&lt;form className="" onSubmit={newComment}&gt;
      &lt;textarea type="text" rows="3" name="body" /&gt;
      &lt;button className="btn" type="submit"&gt;
          Comment
      &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Should I have an <code>onChange</code> event on the <code>&lt;textarea&gt;</code>, and in a function test to see if the <kbd>Enter</kbd> key was pressed? This is how I would do it with vanilla JavaScript but I couldn't find the key event in React's synthetic event.</p>