React DND, Failed PropType

Viewed 246

I'm stuck on how when I go to drag my component, my console is telling me that I've failed to declear the propType inside my render function, when it's declared as const { connectDragSource, isDraggin } = this.props;. I've noticed if I remove the is Dragging property from my KnightSource object, that it fixes this error, but I have no clue as to why.

import React, { Component, PropTypes } from 'react';
import { ItemTypes } from './Constants';
import { DragSource } from 'react-dnd';

const knightSource = {
  beginDrag(props) {
    return {};
  },

  isDragging(props){
      return(console.log('dragging'))
  }
};

function collect(connect, monitor) {
  return {
    connectDragSource: connect.dragSource(),
    isDragging: monitor.isDragging()
  }
}

class Knight extends Component {
  render() {
    const { connectDragSource, isDragging } = this.props;
    return connectDragSource(
      <div style={{
        opacity: isDragging ? 0.5 : 1,
        fontSize: 100,
        fontWeight: 'bold',
        cursor: 'move',
        color: isDragging ? 'blue' : 'green'
      }}>
        ♘
      </div>
    );
  }
}

Knight.propTypes = {
  connectDragSource: PropTypes.func.isRequired,
  isDragging: PropTypes.bool.isRequired
};

export default DragSource(ItemTypes.STUDENT, knightSource, collect)(Knight);
1 Answers
Related