Untitled
unknown
plain_text
a year ago
477 B
6
Indexable
useEffect(() => { const handleBeforeUnload = (e) => { if (isUploading) { const message = 'An upload is in progress. Are you sure you want to leave?'; e.returnValue = message; // For most browsers return message; // For some older browsers } }; if (isUploading) { window.addEventListener('beforeunload', handleBeforeUnload); } return () => window.removeEventListener('beforeunload', handleBeforeUnload); }, [isUploading]);
Editor is loading...
Leave a Comment