Hi i have a question about this notation:
export default DropTarget('answerSlot', spec, collect)(ItemSlot);
Just need to know what to search or what does it mean when after dropTarget() is another (className)
Full my code of this look like this:
import React from "react";
import {DropTarget} from "react-dnd";
interface IProps {
children ?: any,
connectDropTarget: (item: any) => any,
}
interface IStates {
}
const spec = {
drop(props, monitor, component) {
const item = monitor.getItem()
console.log(monitor.getDropResult());
props.onDrop(item);
return item;
},
};
const collect = (connect, monitor) => {
return {
connectDropTarget: connect.dropTarget(),
};
};
class ItemSlot extends React.PureComponent<IProps, IStates> {
render() {
const { connectDropTarget } = this.props;
return (
connectDropTarget(
<div style={{width: '200px', height: '50px', backgroundColor: 'blue'}} className={'m-1'}>
{this.props.children}
</div>,
)
);
}
}
export default DropTarget('answerSlot', spec, collect)(ItemSlot);