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

Method render

examples/01 Dustbin/Multiple Targets/Dustbin.js:39–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 };
38
39 render() {
40 const { accepts, isOver, canDrop, connectDropTarget, lastDroppedItem } = this.props;
41 const isActive = isOver && canDrop;
42
43 let backgroundColor = '#222';
44 if (isActive) {
45 backgroundColor = 'darkgreen';
46 } else if (canDrop) {
47 backgroundColor = 'darkkhaki';
48 }
49
50 return connectDropTarget(
51 <div style={{ ...style, backgroundColor }}>
52 {isActive ?
53 'Release to drop' :
54 `This dustbin accepts: ${accepts.join(', ')}`
55 }
56
57 {lastDroppedItem &&
58 <p>Last dropped: {JSON.stringify(lastDroppedItem)}</p>
59 }
60 </div>,
61 );
62 }
63}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected