Skip to content

Nesting - Drop Targets

Drop targets can be nested. IsOver is true for every target under the pointer, while IsOverShallow (React DnD's isOver({ shallow: true })) is true only for the innermost one. Drag the box over the nested squares to see the difference. A drop reaches every target under the pointer, innermost first: each level's OnDrop runs and publishes its name as the drop's Result, and the source's OnEnd reads the result that won - an outer target's overrides an inner one's, React DnD's rule. Make the targets greedy and an outer level first asks Monitor.DidDrop(): true once an inner level took the drop, so it leaves it alone and the innermost result stands.

Drag me into the nest
level 0
level 1
level 2
level 3

= shallow hover (innermost)   = also over (ancestor)

The last drop

  1. Nothing dropped yet.
An unhandled error has occurred. Reload 🗙