I\'m looking for a way to detect if a click event happened outside of a component, as described in this article. jQuery closest() is used to see if the target from a click e
Material-UI has a small component to solve this problem: https://material-ui.com/components/click-away-listener/ that you can cherry-pick it. It weights 1.5 kB gzipped, it supports mobile, IE 11 and portals.