title: Passing props to Higher-Order Component
body: <p>I have a higher-order component <code>FormBuilder</code> like this:</p>
  
  <pre><code>const FormBuilder = (WrappedComponent) =&gt; {
    return class HOC extends React.Component {
      clearForm() { // ... }
  
      render() {
        return (
          &lt;Form onSubmit={//what do I say here?!}&gt;
             &lt;Form.Input placeholder='Name' name='name' /&gt;
             &lt;WrappedComponent clearForm={this.clearForm} /&gt;
          &lt;Form&gt;
        );
      }
    }
  }
  </code></pre>
  
  <p>And here is the WrappedComponent <code>NewPizzaForm</code>:</p>
  
  <pre><code>class WrappedComponent extends React.Component {
    onSubmit() { // sends a POST request to the backend, then this.props.clearForm() }
  
    render() {
       return (
         &lt;Form.Button&gt;Add Pizza&lt;/Form.Button&gt;
       );
    }
  }
  
  const NewPizzaForm = FormBuilder(WrappedComponent);
  
  export default NewPizzaForm;
  </code></pre>
  
  <p>So I want to send the <code>onSubmit</code> function as a prop from the <code>WrappedComponent</code> to the <code>FormBuilder</code> so that it is available for call when the form is submitted. And the reason I decided to define the <code>onSubmit</code> function inside <code>WrappedComponent</code> is because I have another <code>WrappedComponent</code>(uses <code>FormBuilder</code>) that has the <code>onSubmit</code> function but it sends a PATCH request rather than POST request. How do I achieve this?</p>