Documentation
Hooks
usePointers

usePointers

Handle all the user pointer events (opens in a new tab) at once.

Start pointing with your fingers or mouse.

tip

Some browsers has a built-in touch actions, so if you try to use it the browsers will cancel it, you can disable these defaut touch actions in CSS using touch-action: none

Type Definitions

type PointerEventHandler = (event: PointerEvent, pointers: PointerEvent[]) => any;
type PointerEventName<E = keyof HTMLElementEventMap> = E extends `pointer${string}` ? E : never;
 
const usePointers: <T extends HTMLElement = HTMLDivElement>(args: {
    handler: PointerEventHandler;
    ref?: React.RefObject<T> | null;
    capture?: boolean;
}) => React.RefObject<T>;