I have nested popovers from Material-ui to create a menu with sub-menus. When I click one of the menu options I would like all of the popovers to close. Similarly, I would like all of the popovers to close on click away instead of having to click away multiple times to close them one at a time.
This would be a little simpler if I kept all of the code within one component, but I need to be able to reuse this code, so I prefer to keep it separated like it currently is. I have tried to change the handle functions to the parent component to no avail.
I have created a CodeSanbox example of my code: https://codesandbox.io/embed/friendly-sunset-dznur
I'm not sure how to make the popovers close when I click a menu item, but at the very least I would expect both popovers to close on click away.