use-onclickoutside
use-onclickoutside copied to clipboard
fix: support ref callbacks
This should add support for Ref Callbacks.
How would you use it?
It would allow to use the "callback refs" as described by the React docs.
const [element, setElement] = useState(null);
useOnClickOutside(element, callback);
return <div ref={setElement} />;
In react-popper
we recommend to use them because we need to react to the refs changes, you can find an explanation of the use case here:
https://github.com/popperjs/react-popper/issues/241#issuecomment-591411605