Sha256: ebec339d86e838e36c9ee3334eeb8a2e6152b0a22f34663f3a021986c540e93a
Contents?: true
Size: 391 Bytes
Versions: 15
Compression:
Stored size: 391 Bytes
Contents
import { useEffect, useRef } from "react"; export default function useDraggable(draggable, startDrag) { const ref = useRef(); const handleDrag = (evt) => { evt.preventDefault(); evt.stopPropagation(); startDrag(evt, draggable); }; useEffect(() => { draggable.ref.current = ref.current; }, []); return { ref: ref, onDragStart: handleDrag, draggable: true }; }
Version data entries
15 entries across 15 versions & 1 rubygems