Wednesday, April 10th, 2024
Posted by Yongmin
A hook to detect clicks outside of a ref.
It uses getBoundingClientRect to detect clicks outside of the ref. (not the element itself).
getBoundingClientRect
So it is useful when there is floating elements created by React Portals.