title: Add an onClick to a submit button in React form
body: <p>The Button</p>
  <p>(this submit button is not working, and if i delete the onClick, the submit works. how can i make both, the onClick and the Submit to work.)</p>
  <pre><code> &lt;input
         type=&quot;submit&quot;
         value=&quot;Make the purchase&quot;
         onClick={nextStep}
   /&gt;
  </code></pre>
  <p>The whole Form</p>
  <pre><code> &lt;form id=&quot;my-form&quot; className=&quot;contact-form&quot; onSubmit={sendEmail}&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={shippingData.firstName} /&gt;
        &lt;br /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={shippingData.lastName} /&gt;
        &lt;br /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={shippingData.email} /&gt;
        &lt;br /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={shippingData.address1} /&gt;
        &lt;br /&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={shippingData.zip} /&gt;
        &lt;br /&gt;
  
        &lt;input type=&quot;hidden&quot; name=&quot;name&quot; value={myJSON}&gt;&lt;/input&gt;
        &lt;div&gt;
          &lt;input
            type=&quot;submit&quot;
            value=&quot;Make the purchase&quot;
            onClick={nextStep}
          /&gt;
        &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>