Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Display a warning message when navigating from an unsaved form in React

.
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 28, 2018

Hi,
In JIRA, a warning message appears when trying to navigate away from the current page with unsaved data entered into a form. This behaviour is exactly like what I am trying to achieve but unfortunately, there is an open issue with the Prompt component in the react-router-dom (https://github.com/ReactTraining/react-router/issues/5405). The issue prevents the browser's back button from behaving correctly and changes the URL even when the user cancels the navigation.
This scenario has been rather tricky and I haven't been able to find a solution or any solid examples of it working in React so it would be greatly useful if someone could possibly advise how to achieve this behaviour. Any general tips would also be much appreciated

Regards,
Patrick

0 answers

Suggest an answer

Log in or Sign up to answer