react-use-pointer-drag
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

react-use-pointer-drag

workflow npm npm NPM

A simple hook for handling drag and move actions in React apps.

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 })} />;

Package Sidebar

Install

npm i react-use-pointer-drag

Weekly Downloads

49

Version

0.1.2

License

BSD-3-Clause-Clear

Unpacked Size

20.6 kB

Total Files

6

Last publish

Collaborators

  • mat-sz