sdr34 / react-hook-kit

React Hook Kit: A TypeScript library of reusable custom hooks for accelerating React application development.
MIT License
4 stars 3 forks source link

Implement useOnClickOutside hook #8

Closed sdr34 closed 1 year ago

sdr34 commented 1 year ago

This issue is for a feature request to add a new custom hook, useOnClickOutside, to our library.

The useOnClickOutside hook is often used to detect clicks that happen outside of a specified element. This can be useful in a variety of scenarios, such as closing dropdown menus, modals, or custom tooltips when a user clicks outside of these components.

The hook would take a ref (the element to detect clicks outside of) and a callback (the function to be executed when an outside click is detected) as arguments.

Implementing this hook would provide developers with an easier and cleaner way to handle such user interactions, reducing the complexity of their components.

We encourage any contributions, suggestions, and discussions around this proposed feature.