Skip to content

Commit cfa8c93

Browse files
authored
Update Navbar.js
Add Listener Cleanup
1 parent e4f96d0 commit cfa8c93

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Navbar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ function Navbar() {
2323

2424
useEffect(() => {
2525
showButton();
26+
window.addEventListener('resize', showButton);
27+
return {
28+
window.removeEventListener('resize', showButton)
29+
}
2630
}, []);
2731

28-
window.addEventListener('resize', showButton);
2932

3033
return (
3134
<>

0 commit comments

Comments
 (0)