Updates to the non-stable, hooks-based API.
-
Add useDragPreview hook.
- accepts a refForwarding component and returns an array with a component in slot zero that renders the component into a detached portal, and a ref in slot 1 that may be used in the dragSpec.
-
useDrag
- the
begin()
function is now optional, and returnsvoid
. - the first argument of
end()
is the DragResult - the
type
property has been removed - add a required
item
property, which must contain a type field - make the
ref
field optional, if this is not set, then one will be created. - returns an array: collected props in slot zero and the ref being used in slot 1
- the
-
useDrop
- the
type
property has been renamedaccept
- the
drop
,hover
andcanDrop
functions now take the DragItem as the first argument. - make the
ref
field optional, if this is not set, then one will be created. - returns an array: collected props in slot zero and the ref being used in slot 1
- the