If a user has entered some input, or the current Route is in a “dirty” state and we want to confirm that data will be lost, React Router v4 provides a Prompt component to interrupt the Route transition and ask the user a question.
Cool example. How come you didn't have to bind the setDirty
method to this
?
Gilad, Joe is using arrow function, so you don't have to manually bind the handler in the class constructor.
Hello, is there any way to replicate the functionality from the Angular router to intercept the route change and only allow the transition only when data is loaded? On the subject, is there any way to block the router transition without the use of js blocking operations (alert/prompt)?