Migration guide
A comprehensive guide to migrate from @dnd-kit/core
to @dnd-kit/react
Update dependencies
Update your package.json
and install the new packages:
After updating your package.json, install the new dependencies with your package manager of choice.
Migrate context provider
Update your context provider. The new DragDropProvider replaces the legacy DndContext
:
The new provider gives you access to the manager
instance in event handlers, enabling more advanced control over the drag and drop system.
Update draggable components
Update your draggable components using the new useDraggable hook:
Update droppable components
Update your droppable components using the new useDroppable hook:
Update drag overlay
The DragOverlay component has been simplified:
Only render the DragOverlay
component once per DragDropProvider
. The hooks have no effect when used within the overlay.
Migrate sortable components
Update your sortable components using the new useSortable hook:
Use the array manipulation helpers from @dnd-kit/helpers
to handle reordering.