Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ProjectContainer = ({ history, routes }) => {
- const onBeforeUnload = (event) => {
- if (history.location.pathname !== '/saving-package') {
- event.returnValue = 'Changes will not be saved. This action cannot be undone';
- }
- };
- useEffect(() => {
- window.addEventListener('beforeunload', onBeforeUnload);
- return () => window.removeEventListener('beforeunload', onBeforeUnload);
- });
- return (
- // ...routes
- );
- };
Add Comment
Please, Sign In to add comment