useMove

Track the position of the pointer inside an element as a value between 0 and 1.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Press and drag inside the box to move the dot.

APIs

useMove

const useMove = <T extends HTMLElement = HTMLElement>(
  onChange: (value: { x: number; y: number }) => void,
  onScrubEnd?: () => void,
) => { ref: RefObject<T | null>; active: boolean }
Edit this page on GitHub