@hydroperx/drag4react
Version:
React drag-n-drop
26 lines (20 loc) • 539 B
Markdown
Drag-n-drop for React.
```tsx
import Draggable from "@hydroperx/drag4react";
import { useRef } from "react";
function Content()
{
const div_ref = useRef<HTMLDivElement | null>(null);
return (
<Draggable nodeRef={div_ref}>
<div ref={div_ref}>
Drag me
</div>
</Draggable>
);
}
```
The library as part of the `draggable` dependency uses `inset`/`left`/`top` for moving elements.