beforeRouteChange equivalent on Next 13 app router
Unanswered
Asian black bear posted this in #help-forum
Asian black bearOP
I want to implement a unsaved content alert feature in my project. Basically, if the user want to change to another page without saving the content he wrote a modal appears to warn it, but to do so I need to listen something like a "beforeRouteChange" event, which is not available on app router. I know there is a
usePathname hook that can be used to listen "onRouteChange", but I want to listen to "beforeRouteChange"2 Replies
European sprat
Unfortunately it doesn't exist and there's no effective workaround/hack for it
The conclusion I came to from researching it was "just auto save"