daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const ProjectContainer  = ({ history, routes }) => {
  2.     const onBeforeUnload = (event) => {
  3.         if (history.location.pathname !== '/saving-package') {
  4.             event.returnValue = 'Changes will not be saved. This action cannot be undone';
  5.         }
  6.     };
  7.     useEffect(() => {
  8.         window.addEventListener('beforeunload', onBeforeUnload);
  9.         return () => window.removeEventListener('beforeunload', onBeforeUnload);
  10.     });
  11.     return (
  12.         // ...routes
  13.     );
  14. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top