beautiful-react-hooks
Version:
A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development
14 lines (13 loc) • 450 B
TypeScript
import { RefObject } from 'react';
/**
* Returns the current state (position) of the mouse pointer.
* It possibly accepts a DOM ref representing the mouse target.
* If a target is not provided the state will be caught globally.
*/
declare const useMouseState: <TElement extends HTMLElement>(targetRef?: RefObject<TElement>) => {
clientX: number;
clientY: number;
screenX: number;
screenY: number;
};
export default useMouseState;