【发布时间】:2018-10-08 15:32:53
【问题描述】:
在我的项目中,我试图初始化 react-big-calendar 但它说它不存在。
Uncaught TypeError: Cannot read property 'momentLocalizer' of undefined
我的包版本:“react-dom”:“16.2.0”,“react-big-calendar”:“^0.20.1”,“moment”:“^2.22.2”,
有人有解决这些问题的办法吗?
我知道存在这样的问题,但它涉及不需要本地化程序的旧版本。
import * as React from 'react';
import BigCalendar from 'react-big-calendar';
import * as moment from 'moment';
class CalendarContainer extends React.Component {
constructor(props: any) {
super(props);
}
render() {
const localizer = BigCalendar.momentLocalizer(moment);
return (
<>
<BigCalendar localizer={localizer} events={events} />
</>
);
}
}
export default CalendarContainer;
【问题讨论】:
-
您会发布产生错误的相关
code吗? -
我已经编辑了我的帖子
标签: reactjs momentjs react-big-calendar