我有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.
有什么想法可能导致这种情况吗?在此先感谢您的任何建议。