dptoot/react-event-calendar

Error when rendering EventCalendar

Opened this issue · 3 comments

Using React 0.14.8. I npm installed the component:

app@0.5.0 /Users/tim.sheridan/Code/app
`-- react-event-calendar@0.3.0 
  +-- calendar-base@0.2.1 
  `-- classnames@2.2.5 

Implemented to EventCalendar based on example to render:

render: function() {

        const events = _.map(this.props.events, (function(e) {
            const from = moment(e.fromDate).format('YYYY-MM-DD');
            return {
                start: from,
                end: from,
                title: e.name,
                description: e.name,
                data: '',
                eventClasses: ''
            };
        }));

        return (
            <div>
                <EventCalendar
                    month={12}
                    year={2016}
                    events={events} />
            </div>
        );
    }

Got the following error in the console:

invariant.js:39 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of 'CalendarView'.(…)

Has anyone seen this error as well? Any suggestions on how to fix or workaround? Most appreciated for any help.

Thanks
Tim

Hey Tim,

Try importing 'react-event-calendar'

import EventCalendar from 'react-event-calendar'

Doupi commented

Hey @danielmk22,

I tried import EventCalendar from 'react-event-calendar'. But it cannot work.

Hey @timcan,

Is your issue solved?

Thanks.

I had the same issue and import EventCalendar from 'react-event-calendar' resolved it