'How to react clicks on an overlay flexbox(Material UI Grid) element

I have an overlay element, the overlay element is a flexbox container, there is only one item which is centered, so there is space around it.

If someone clicks on the extra space around this element, I want the overlay to disappear.

How do I respond to mouse click ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source