asking custom question
function handlePageReload(event:any) {
const message = 'Are you sure you want to reload the page?';
event.returnValue = message;
return message;
}
useEffect(() => {
window.addEventListener('beforeunload', handlePageReload);
return () => {
window.removeEventListener('beforeunload', handlePageReload);
};
}, []);
I need show reload dialog box every refresh on the browser. how?