Close dropdown-menu when component unmounts

This commit is contained in:
Chewbacca 2023-02-14 12:18:26 -05:00
parent 783a79d306
commit d19f8a267a

View file

@ -211,6 +211,11 @@ const DropdownMenu = (props: IDropdownMenu) => {
}
};
useEffect(() => {
return () => {
dispatch(closeDropdownMenu());
};
}, []);
useEffect(() => {
document.addEventListener('click', handleDocumentClick, false);