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

Development of useHover Hook for Mouse Hover Detection #19

Closed sdr34 closed 11 months ago

sdr34 commented 1 year ago

Description:

The goal of this issue is to develop a useHover custom hook in our codebase that will enable us to determine if the mouse cursor is hovered over a specific component or element.

Details:

Currently, our codebase lacks a convenient, reusable way to detect whether a cursor is hovering over a component. Creating a useHover hook would improve the user experience and allow for more interactive components.

The expected behavior of this hook is:

Accept a ref as an input. Return a boolean indicating whether the cursor is currently hovering over the element corresponding to the provided ref.

Tasks:

Develop the useHover hook according to the specifications. Write unit tests to ensure the hook functions as expected. Document the hook's functionality, usage, and provide examples. Ensure the hook is performant and does not cause unnecessary re-renders.

Acceptance Criteria:

The hook accurately detects when the cursor is hovering over the component it is attached to. The hook has comprehensive unit tests which pass. The hook is properly documented. The hook does not impact overall app performance.