monitor.getDropResult() return null monitor.getDropResult() return null reactjs reactjs

monitor.getDropResult() return null


You need to create a DropTarget and define a drop() function within its source, and whatever that returns will be what is returned by the monitor.getDropResult() function inside of the DragSource's endDrag() function (per http://gaearon.github.io/react-dnd/docs-drag-source-monitor.html). I'm not sure what you'd like the component itself to look like, but if you created a DropTarget with a drop function resembling:

const stoneDropSource = {  drop(props, monitor) {    return monitor.getItem();  },}

Then that is what you would receive from calling getDropResult() in the endDrag() function.