DOM events

onDragStart

Initialize drag data for a draggable element. Never place secrets in transfer data. Provide an ordinary button alternative for the same operation.

Formal Syntax & Structure

react syntaxreact
onDragStart={handler}

Working Example

Example Snippetreact
export default function App(){return <><span draggable onDragStart={e=>e.dataTransfer.setData('text/plain','tool-1')}>Tool 1</span><button onClick={()=>console.log('tool-1')}>Select Tool 1</button></>}
React Reference