title: how to use in Reactjs functional component history.push
body: <p>I have a functional component that has form. Onsubmit call I would like to redirect to another page.   </p>
  
  <pre><code>function ProfileForm(props) {
   // many code removed
   const onSubmit = (data, e) =&gt; {
     e.target.reset();
     history.push({
    pathname:  "/OnSubmit",
    state: {
      response: messageFromServer 
     } 
    }
  }
  // many code removed
  }
  </code></pre>
  
  <p>I got this erro:-</p>
  
  <blockquote>
    <p>Unexpected use of 'history'  no-restricted-globals</p>
  </blockquote>
  
  <p>After Googling the error I found a similar kind of answer for location. Answer was: 
  <code>Try adding window before location (i.e. window.location).</code>
  So I tried:-</p>
  
  <pre><code>  window.history.push({
    pathname:  "/OnSubmit",
    state: {
      response: messageFromServer 
    } 
  }
  </code></pre>
  
  <p>got new error:-</p>
  
  <blockquote>
    <p>Unhandled Rejection (TypeError): window.history.push is not a function</p>
  </blockquote>