1
0
Fork 0
web2019/static/js/shop/dnd/Draggable.jsx

15 lines
380 B
JavaScript

import React from 'react';
import {useDraggable} from '@dnd-kit/core';
export function Draggable(props) {
const Element = props.element || 'div';
const {attributes, listeners, setNodeRef} = useDraggable({
id: props.id,
});
return (
<Element ref={setNodeRef} {...listeners} {...attributes}>
{props.children}
</Element>
);
}