I have one sensitive route /test
. And if the user wants to leave this route, I want to show him some confirmation window, if he presses cancel button - nothing is going to change if he confirms then - function some()
must be executed and route must also be changed.
Asked
Active
Viewed 125 times
0
-
https://reacttraining.com/react-router/web/example/preventing-transitions – Se0ng11 Jun 05 '18 at 06:26
-
2Please check this question [Detect User leaving Page](https://stackoverflow.com/questions/32841757/detecting-user-leaving-page-with-react-router/45869459#45869459) – Shubham Khatri Jun 05 '18 at 06:27
-
@Se0ng11, thank you very much. It is exactly what I was looking for. – jsDev Jun 05 '18 at 06:42
-
@ShubhamKhatri Thank you very much, you just save my day. – jsDev Jun 05 '18 at 06:44
-
@NazariyMural glad to have helped – Shubham Khatri Jun 05 '18 at 06:54