import React, { Component } from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { DragSource, DropTarget } from 'react-dnd' class DraggableSeed extends Component { static propTypes = { // React DnD Props connectDragSource: PropTypes.func.isRequired, connectDropTarget: PropTypes.func.isRequired, isDragging: PropTypes.bool, isOver: PropTypes.bool, canDrop: PropTypes.bool, // Own Props onClick: PropTypes.func.isRequired, setHoveringIndex: PropTypes.func.isRequired, index: PropTypes.number, draggingSeedIndex: PropTypes.number, word: PropTypes.string, className: PropTypes.string, selected: PropTypes.bool, droppable: PropTypes.bool, } static defaultProps = { className: '', onClick () {}, } componentWillReceiveProps (nextProps) { const { isOver, setHoveringIndex } = this.props if (isOver && !nextProps.isOver) { setHoveringIndex(-1) } } render () { const { connectDragSource, connectDropTarget, isDragging, index, word, selected, className, onClick, isOver, canDrop, } = this.props return connectDropTarget(connectDragSource(