回答編集履歴
1
typoの修正
test
CHANGED
@@ -6,15 +6,15 @@
|
|
6
6
|
|
7
7
|
useEffect(() => {
|
8
8
|
|
9
|
-
const call
|
9
|
+
const callback = () => console.log('before unload')
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
window.addEventListener('beforeunload', call
|
13
|
+
window.addEventListener('beforeunload', callback)
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
return () => window.removeEventListener('beforeunload', call
|
17
|
+
return () => window.removeEventListener('beforeunload', callback)
|
18
18
|
|
19
19
|
}, [])
|
20
20
|
|