I have a top-level component that consists of a few different components.
- InventoryBox - designates the space that an inventory contains
- InventoryList - designates the list of items in the inventory
- Item - a single item in the inventory list
InventoryBox is the top-level component, so I have wrapped it in a DragDropContext. The issue I am running into is that the connectDragSource function that I specified in my collect function is not injecting the method into my item components.
My Collect Function
function collect(connect, monitor) {
return {
connectDragSource: connect.dragSource(),
isDragging: monitor.isDragging()
};
}
My Item Component
var Item = React.createClass({
render: function(){
var id = this.props.id;
var isDragging = this.props.isDragging;
var connectDragSource = this.props.connectDragSource;
return (
<div className="item">
{this.props.children}
</div>
);
}
});
My ultimate goal would be to drag the Item components from the list to another Inventory Box.