import 7b usebeforeunload 7d from 27react beforeunload

Solutions on MaxInterview for import 7b usebeforeunload 7d from 27react beforeunload by the best coders in the world

showing results for - "import 7b usebeforeunload 7d from 27react beforeunload"
Edoardo
08 Feb 2020
1window.addEventListener('beforeunload', (event) => {
2  event.returnValue = `Are you sure you want to leave?`;
3});
4
Aubin
09 Feb 2017
1let formChanged = false;
2myForm.addEventListener('change', () => formChanged = true);
3window.addEventListener('beforeunload', (event) => {
4  if (formChanged) {
5    event.returnValue = 'You have unfinished changes!';
6  }
7});
8
Elisa
11 Feb 2016
1useBeforeunload(() => "You'll lose your data!");
2
Elena
26 Aug 2017
1import { useBeforeunload } from 'react-beforeunload';
2
Luigi
27 Nov 2020
1useBeforeunload((event) => event.preventDefault());
2