it attaches drag event handlers to make child item draggable
Example
<Draggablekey={member.id}type={DragDropTypes.CARD}// type of objectdata={member}// custom data object (info about draggable-item)onDragStart={(e)=>console.log("onDragStart",e)}onDragEnd={(e)=>console.log("onDragEnd",e)}><ProfileCardid={member.id}name={member.name}avatar={member.thumb}/></Draggable>// NOTE: `type` prop will be used to identify if drop-target accepts this type of items
Droppable component
it attaches drop handlers on child & makes the child item a valid drop-target
Example
<DroppableacceptedTypes={DragDropTypes.CARD}// only these types are acceptedonDrop={onDrop}onDragEnter={onDragEnter}onDragLeave={onDragLeave}className={cn("droppable",{hovering: isHoveringDropzone})}><TeamMembersListteamId="Team-A"members={members}/></Droppable>
React ContextAPI & custom hooks
this example is using Context API & custom hooks under the hood
the related part of your app should be wrapped inside DragDropProvider