I have a react redax application, and after I save a new object of tabs in redax, I need the user to receive a notification if he wants to refresh the page, saying that you really want to refresh the page without saving, in which case you upload the changes and if it clicks cancel reboot is not done, how can I implement thi
Asked
Active
Viewed 91 times
0
-
Have a look at the [beforeunload event](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) – Dominik Nov 06 '20 at 22:54
1 Answers
0
the window.onbeforeunload javascript API provides an attribute which you can asign a function:
window.onbeforeunload = () => {
// Add internal app logic here
};

Fabio Lopez
- 517
- 2
- 5
- 15