DOM events

onDrop

Handle a drop on an eligible target. Prevent default in dragover and drop, and validate transferred content as untrusted input. Never insert arbitrary dropped HTML.

Formal Syntax & Structure

react syntaxreact
onDrop={handler}

Working Example

Example Snippetreact
export default function App(){return <div onDragOver={e=>e.preventDefault()} onDrop={e=>{e.preventDefault();if(e.dataTransfer.getData('text/plain')==='tool-1')console.log('Accepted');}}>Drop Tool 1 here (or use selection in the source list)</div>}
React Reference