0.1.2 • Published 8 months ago

react-use-pointer-drag v0.1.2

Weekly downloads
-
License
BSD-3-Clause-Clea...
Repository
-
Last release
8 months ago

Example usage

Simple:

// In component:

const { dragProps } = usePointerDrag({
  onMove: ({ x, y }) => {
    // Do something.
  },
});

return <div {...dragProps()} />;

With state:

// In component:

const { dragProps } = usePointerDrag<{ clip: Clip }>({
  onMove: ({ x, y, state: { clip } }) => {
    // Do something.
  },
});

return <div {...dragProps({ clip })} />;