title: How to trigger the onsubmit event programmatically in reactjs?
body: <p>I need to programmatically call the onsubmit event of a form on click of a div element. I do not want to actually submit the form. I just want to call the onSubmit event. How do I achieve this?</p>
  
  <pre><code>    &lt;form onSubmit={(event)=&gt; {event.preventDefault();this.submitFunction()}&gt;
   &lt;ButtonWithIcon onClick={this.onClick} type="submit"&gt;
   &lt;/div&gt;
   &lt;/form&gt;
  
  onClick=()=&gt; { //need to call the call the onsubmit event }
  </code></pre>
  
  <p>ButtonWithIcon is a custom component that has the  as well as icon. So clicking on icon will not submit the form. On clicking of icon, I need </p>
  
  <pre><code>{(event)=&gt; {event.preventDefault();this.submitFunction()} to execute
  </code></pre>