Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
93.56k
stars
32.19k
forks
source link
Using Dialog component to alert navigating away using React Router #5611
Closed
abzfarah closed 7 years ago
Hi
I've been stuck on this problem for days and I would like your advise on how to solve a problem I am having.
Basically I am using the Stepper component to hold multiple forms, and each Step is actually a child component with a separate route.
I am trying to show a dialog if a user tries to leave with unsaved changes.
I have tried to follow the solution here: http://stackoverflow.com/questions/35275344/how-to-use-a-custom-component-with-react-router-route-transitions/35793421#35793421
to no avail. What is the best approach to solving this? i.e Detect route change, tell react router to WAIT for user confirmation.
thank you