How to Handle Route Change Triggers and Show Popup in Next.js 15 #75234
Unanswered
ahmerarain
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I’m working on a Next.js 15 project (JavaScript, not TypeScript) where I need to show a popup when the user is about to leave a page. The popup should notify the user that they’ll lose data if they proceed with actions such as:
I would like the user to have the option to either:
Here’s what I’ve done so far:
However, I’m still working on how to perfectly manage both situations (reload and internal route change) while showing the popup.
Does anyone have suggestions or examples of how to handle this in a clean way? Any help would be appreciated!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions