title: Avoid routing when page is dirty
body: <p>Im trying to find a way to intercept the route-change before it gets execute to do a dirty-check of a form, prompting the user with a confirm message (like, You have pending changes, are you sure you want to discard?)</p>
  
  <p>For now, i have tried adding a function to the onLeave prop on 
  
  <p>So im pretty much looking for something like this</p>
  
  <pre><code>&lt;Route onLeave={() =&gt; doSomething()} /&gt;
  
  const doSomething = (ev) =&gt; {
      if(confirm("Are you sure")){
        //Continue the routing
        return true; 
      }else{
        //Dont route, stay on the current page
        return false;
      }    
  
  } 
  </code></pre>