use-onclickoutside icon indicating copy to clipboard operation
use-onclickoutside copied to clipboard

fix: support ref callbacks

Open FezVrasta opened this issue 4 years ago • 2 comments

This should add support for Ref Callbacks.

FezVrasta avatar May 13 '20 10:05 FezVrasta

How would you use it?

Andarist avatar May 13 '20 12:05 Andarist

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

FezVrasta avatar May 13 '20 13:05 FezVrasta