wellyshen / react-cool-onclickoutside

😎 🖱 React hook to listen for clicks outside of the component(s).
https://react-cool-onclickoutside.netlify.app
MIT License
549 stars 13 forks source link

How can I get this work for a node element that already has a ref #972

Open Yeran opened 6 months ago

Yeran commented 6 months ago

ISSUE DESCRIPTION: I am trying to use the lib to close a modal dialog whenever a click happens outside the modal(on backdrop), but the dialog itself has a ref for its main functionality.

SNIPPET: image

QUESTION: Is there any workaround to get this work for a node element that already has a ref (for the dialog in the given specific case) ?

avaya-jashmore commented 1 month ago

Have you tried passing refs in the options? https://github.com/wellyshen/react-cool-onclickoutside?tab=readme-ov-file#use-your-own-ref