MCPcopy Create free account
hub / github.com/react-dnd/react-dnd / constructor

Function constructor

examples/01 Dustbin/Multiple Targets/Container.js:11–27  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

9@DragDropContext(HTML5Backend)
10export default class Container extends Component {
11 constructor(props) {
12 super(props);
13 this.state = {
14 dustbins: [
15 { accepts: [ItemTypes.GLASS], lastDroppedItem: null },
16 { accepts: [ItemTypes.FOOD], lastDroppedItem: null },
17 { accepts: [ItemTypes.PAPER, ItemTypes.GLASS, NativeTypes.URL], lastDroppedItem: null },
18 { accepts: [ItemTypes.PAPER, NativeTypes.FILE], lastDroppedItem: null },
19 ],
20 boxes: [
21 { name: 'Bottle', type: ItemTypes.GLASS },
22 { name: 'Banana', type: ItemTypes.FOOD },
23 { name: 'Magazine', type: ItemTypes.PAPER },
24 ],
25 droppedBoxNames: [],
26 };
27 }
28
29 isDropped(boxName) {
30 return this.state.droppedBoxNames.indexOf(boxName) > -1;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected