Drag an element with the pointer and read how far it moved.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Drag the box, the position is kept between drags.
const useDrag = <T extends HTMLElement = HTMLElement>() => {
ref: RefObject<T | null>
dragging: boolean
position: { x: number; y: number }
reset: () => void
}