With nextjs 12 (pages router) the router returned from 'next/router' had navigation events you could listen for and handle appropriately. Here is the documentation.
One specific event is routeChangeStart. When you want prompt a user before they leave a page you have listen for that event, then open a modal and throw an error to prevent navigation.
With nextjs 13 (app router) the router returned from 'next/navigation' does not have the same ability to subscribe to events.
There is a solution in the documentation to tell when a route has already changed. It uses the two new hooks
usePathnameuseSearchParams
Here is that solution.
I want to know BEFORE a route is about to change.
How do you know when a nextjs 13 app (using the app router) is about to navigate, and how do you prevent it from doing so?

If you are using the Link component for the naviation, you can switch it with a custom component and use the useRouter hook.