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

Method render

examples/03 Nesting/Drag Sources/TargetBox.js:36–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34 };
35
36 render() {
37 const { canDrop, isOver, draggingColor, lastDroppedColor, connectDropTarget } = this.props;
38 const opacity = isOver ? 1 : 0.7;
39
40 let backgroundColor = '#fff';
41 switch (draggingColor) {
42 case Colors.BLUE:
43 backgroundColor = 'lightblue';
44 break;
45 case Colors.YELLOW:
46 backgroundColor = 'lightgoldenrodyellow';
47 break;
48 default:
49 break;
50 }
51
52 return connectDropTarget(
53 <div style={{ ...style, backgroundColor, opacity }}>
54
55 <p>Drop here.</p>
56
57 {!canDrop && lastDroppedColor &&
58 <p>Last dropped: {lastDroppedColor}</p>
59 }
60 </div>,
61 );
62 }
63}
64
65export default class StatefulTargetBox extends Component {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected