Run callback when someone exit the page
Hey,
Is there a way to run callback when someone leave the page?
4 Replies
mere-teal•8mo ago
leave where to?
like-goldOP•8mo 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?
mere-teal•8mo 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
like-goldOP•8mo ago
thank you!