Drag props.
An object which identity never changes between renders.
const targetRef = useRef(null);
const { dragProps, isDragged } = useDrag({
onDrag(info) {
targetRef.current.style.inset = `${info.y}px auto auto ${info.x}px`;
}
});
<div
{...dragProps}
ref={targetRef}
style={{
position: 'absolute',
width: 100,
height: 100,
backgroundColor: isDragged ? 'red' : 'blue',
}}
/>
Handles the drag behavior across platforms.