Skip to content

Commit

Permalink
Fix: event listeners
Browse files Browse the repository at this point in the history
I am pretty sure it's a mistake and `removeEventListener` should be called on unmount, instead of rebinding the event.
  • Loading branch information
Dimitri KOPRIWA authored Jan 1, 2021
1 parent 7a69d3a commit f8c52fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/layout/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const Header = ({
document.addEventListener('click', clickOutside);
return () => {
document.removeEventListener('keydown', keyPress);
document.addEventListener('click', clickOutside);
document.removeEventListener('click', clickOutside);
closeMenu();
};
});
Expand Down Expand Up @@ -135,4 +135,4 @@ const Header = ({
Header.propTypes = propTypes;
Header.defaultProps = defaultProps;

export default Header;
export default Header;

0 comments on commit f8c52fb

Please sign in to comment.