Run callback when someone exit the page
Hey,
Is there a way to run callback when someone leave the page?
4 Replies
other-emerald•10mo ago
leave where to?
optimistic-goldOP•10mo ago
For example
User is on /home page, then clicks on Link which redirect him to /settings page and after some time user click on the browers back button and in this time i wanna run callback
So basically, when someone clicks the browers native back button i wanna run the callback, can tanstack router handle this?
other-emerald•10mo ago
there are multiple ways.
you can subscribe to router events or history events
you can also have a look at the blocker if you want to prevent the user leaving
optimistic-goldOP•10mo ago
thank you!