title: Setting onSubmit in React.js
body: <p>On submission of a form, I'm trying to <code>doSomething()</code> instead of the default post behaviour. </p>
  
  <p>Apparently in React, <a href="http://facebook.github.io/react/docs/events.html#form-events" rel="noreferrer">onSubmit is a supported event for forms.</a> However, when I try the following code:</p>
  
  <pre><code>var OnSubmitTest = React.createClass({
      render: function() {
          doSomething = function(){
             alert('it works!');
          }
  
          return &lt;form onSubmit={doSomething}&gt;
          &lt;button&gt;Click me&lt;/button&gt;
          &lt;/form&gt;;
      }
  });
  </code></pre>
  
  <p>The method <code>doSomething()</code> is run, but thereafter, the default post behaviour is still carried out. </p>
  
  <p>You can test this in my <a href="https://jsfiddle.net/ayda5w9m/" rel="noreferrer">jsfiddle</a>.</p>
  
  <p>My question: How do I prevent the default post behaviour?</p>