import { useDrag } from 'react-dnd'; import React from 'react'; const ItemTypes = { TEACHER: 'teacher', }; const TeacherItem = ({ teacher, isDraggable = true }) => { const [{ isDragging }, drag] = useDrag(() => ({ type: ItemTypes.TEACHER, item: { id: teacher.id, name: `${teacher.last_name} ${teacher.first_name}` }, collect: (monitor) => ({ isDragging: !!monitor.isDragging(), }), canDrag: () => isDraggable, }), [isDraggable]); return (