I have catched the event "beforeunload" but I want to do some custom actions and not show the alert message that is shown by default, I want to hide the alert box.
componentDidMount() {
window.addEventListener("beforeunload", ev) => {
ev.preventDefault();
this.customExit(ev);
return null;
}
}
How can I hide the alert box?