我只是按照步骤安装react-dates到我的项目 . 我正在使用他们的包装器作为“hello world”示例,但无法让它运行 .
https://github.com/airbnb/react-dates/blob/master/examples/DateRangePickerWrapper.jsx
但是在141行我得到了运行时错误:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check your code at DateRangePickerWrapper.jsx:141.
in DateRangePickerWrapper (at GroupForm.js:253)
in div (at GroupForm.js:204)
in div (at GroupForm.js:201)
in div (at FuseScrollbars.js:155)
in FuseScrollbars (created by Connect(FuseScrollbars))
in Connect(FuseScrollbars) (created by Route)
in Route (created by withRouter(Connect(FuseScrollbars)))
in withRouter(Connect(FuseScrollbars)) (created by
我尝试不使用包装器,只是直接导入和使用DateRangePicker,将日期参数从字符串设置为moment()到PropTypes null .
在我的index.js中,我有导入'react-dates / initialize'; import'alaction-dates / lib / css / _datepicker.css';
但我觉得我没有正确地初始化它 . 也许我的初始化导入没有被运行,因此无法找到组件名称?
这是一个用'create-react-app'创建的项目