反应大日历很多错误

时间:2018-09-03 14:06:13

标签: reactjs react-big-calendar

我将安装软件包,但无法使用 告诉我很多错误

Uncaught Error: Element ref was specified as a string (inner) but no owner was set. This could happen for one of the following reasons:
1. You may be adding a ref to a functional component
2. You may be adding a ref to a component that was not created inside a component's render method
3. You have multiple copies of React loaded

我的组件

import React, { Component } from 'react'

import BigCalendar from 'react-big-calendar'

import moment from 'moment'

BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment))


class CalendarDashboardBody extends Component {

    state = {
        fake: [
            {
                id: 0,
                title: 'All Day Event very long title',
                allDay: true,
                start: new Date(2015, 3, 0),
                end: new Date(2015, 3, 1),
            },
            {
                id: 1,
                title: 'Long Event',
                start: new Date(2015, 3, 7),
                end: new Date(2015, 3, 10),
            }
        ]
    }
    render() {
        return (
            <BigCalendar
                events={this.state.fake}
                startAccessor='startDate'
                endAccessor='endDate'
            />
        )
    }
}

export default CalendarDashboardBody

0 个答案:

没有答案