Close dropdown-menu when component unmounts
This commit is contained in:
parent
783a79d306
commit
d19f8a267a
1 changed files with 5 additions and 0 deletions
|
@ -211,6 +211,11 @@ const DropdownMenu = (props: IDropdownMenu) => {
|
|||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
dispatch(closeDropdownMenu());
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('click', handleDocumentClick, false);
|
||||
|
|
Loading…
Reference in a new issue