React-day-picker警告

时间:2018-06-15 08:26:18

标签: javascript reactjs react-day-picker

我有MultiDayPicker组件,如下所示:

export default class MultiDayPicker extends Component {
  state = {
    selectedDays: []
  };

  handleDayClick = (day, {selected}) => {
    const { selectedDays } = this.state;
    if (selected) {
      const selectedIndex = selectedDays.findIndex(selectedDay =>
        DateUtils.isSameDay(selectedDay, day)
      );
      selectedDays.splice(selectedIndex, 1);
    } else {
      selectedDays.push(day);
    }
    this.setState({ selectedDays });
  };

  render() {
    return (
        <DayPicker
          selectedDays={this.state.selectedDays}
          onDayClick={this.handleDayClick}
        />
    );
  }
}

不幸的是我收到这样的错误:

console.error node_modules\fbjs\lib\warning.js:33
      Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

任何可能导致此问题的想法? 提前感谢任何建议。

0 个答案:

没有答案