Redux state holds flag for unsaved changes, and I want to prompt user when navigating (clicks a Link) if this flag is set. I'm using react-router-component. I didn't find how to do this in documentation.
Anyone reaching this post in 2018 and using the react router 4+, I'd suggest reading this reacttraining example
TL;DR use the Prompt
component at the top
<Prompt
when={hasUnsavedChanges}
message="There are unsaved changes, do you wish to discard them?"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With