title: NextJS use preventDefault on hashChangeStart event
body: <p>I'm using NextJS with the next/router and I need to use the <code>event.preventDefault()</code> inside the <code>hashChangeStart</code> event but I don't see how can I do it because the handler only has the url as a parameter</p>
  
  <p>This is the code:</p>
  
  <pre><code>  useEffect(() =&gt; {
      const handleRouteChange = url =&gt; {
        // here is where I need to use the event.preventDefault();
        ...
      };
  
      Router.events.on('hashChangeStart', handleRouteChange);
      return () =&gt; {
        Router.events.off('hashChangeStart', handleRouteChange);
      };
    }, []);
  </code></pre>
  
  <p>Any idea on how I can do it? I've also tried to use the <code>window.addEventListener("hashchange", myScript);</code> instead of the <code>Router.events.on</code> but it didn't worked</p>