Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 呈现大日历时出现控制台错误_Javascript_Reactjs_React Big Calendar - Fatal编程技术网

Javascript 呈现大日历时出现控制台错误

Javascript 呈现大日历时出现控制台错误,javascript,reactjs,react-big-calendar,Javascript,Reactjs,React Big Calendar,呈现BigCalendar组件时,我不断收到此控制台错误消息 我怎样才能解决这个问题 未捕获错误:NoopWrapper.render():有效的React元素(或null) 必须返回。您可能返回了未定义、数组或某些 其他无效对象。 at不变量(invariant.js?994a:42) 在ReactCompositeComponentWrapper.\u renderValidatedComponent(ReactCompositeComponent.js?8c6a:828) 在ReactCo

呈现BigCalendar组件时,我不断收到此控制台错误消息

我怎样才能解决这个问题

未捕获错误:NoopWrapper.render():有效的React元素(或null) 必须返回。您可能返回了未定义、数组或某些 其他无效对象。 at不变量(invariant.js?994a:42) 在ReactCompositeComponentWrapper.\u renderValidatedComponent(ReactCompositeComponent.js?8c6a:828) 在ReactCompositeComponentWrapper.PerformitialMount(ReactCompositeComponent.js?8c6a:359)处 在ReactCompositeComponentWrapper.mountComponent(ReactCompositeComponent.js?8c6a:255)处 在Object.mountComponent(ReactReconciler.js?af94:43) 位于ReactDOMComponent.mountChildren(ReactMultiChild.js?0c7d:234) 在ReactDOMComponent.\u createInitialChildren(ReactDOMComponent.js?9b5f:701) 位于ReactDOMComponent.mountComponent(ReactDOMComponent.js?9b5f:520) 在Object.mountComponent(ReactReconciler.js?af94:43) 位于Object.updateChildren(ReactChildReconciler.js?f170:119)”

这是我的密码:

import React from 'react';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
import 'react-big-calendar/lib/css/react-big-calendar.css';

const localizer = BigCalendar.momentLocalizer(moment);

const MyCalendar = () => {
    const dummyEvents = [
        {
            allDay: true,
            end: new Date('October 10, 2018 11:13:00'),
            start: new Date('October 09, 2018 11:13:00'),
            title: 'hi'
        }
    ];
    return (
        <div style={{ height: '60rem' }}>
            <BigCalendar
                events={dummyEvents}
                startAccessor="start"
                endAccessor="end"
                localizer={localizer}
            />
        </div>
    );
};

export default MyCalendar;
从“React”导入React;
从“react big calendar”导入BigCalendar;
从“力矩”中导入力矩;
导入'react big calendar/lib/css/react big calendar.css';
常量定位器=BigCalendar.momentLocalizer(矩);
常量MyCalendar=()=>{
常数dummyEvents=[
{
全天:没错,
结束:新日期('2018年10月10日11:13:00'),
开始日期:新日期('2018年10月9日11:13:00'),
标题:“嗨”
}
];
返回(
);
};
导出默认MyCalendar;

如果您可以指定您正在使用的
react big calendar
的版本,那么它将非常有用

无论如何,我不确定是什么导致了这个问题,但我在使用
react big calendar
0.20.1
版本时也收到了这个错误。临时修复可能是降级并使用例如版本
0.19.2


如果有帮助,请告诉我。

非常感谢你,汤姆克利。我使用的是0.20.1,但降级到0.19.2似乎解决了问题。