0

I am new to using react-big-calendar and somewhat new to react. Trying to simply import and default calendar into a base app created with the react app cli. That said, my base index.js looks like:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';

BigCalendar.momentLocalizer(moment);

const MyCalendar = props => (
    <div>
      <BigCalendar
        events={myEventsList}
        startAccessor='startDate'
        endAccessor='endDate'
      />
    </div>
  );

registerServiceWorker();

I have an event.js as shown in the example, but am thinking I am not getting an event prop somehow. After searching, I cannot find what I may be doing wrong from just trying to use a default calendar within my app. I can clone the calendar and run that way, but that isn't in my app. Looking at the docs and comparing what was done for their examples versus what I am trying to do isn't working.

When I run my app using npm start, I get:

enter image description here

I am hoping someone here can point me in the right directions.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mark
  • 1,812
  • 3
  • 29
  • 51

1 Answers1

0

I dont' see where you are getting the events={myEventsList} from?

There is no imported myEventsList in your event.js

You should be importing myEventList from wherever you are creating it in your application and exporting it so you can use it in other components.

Philipp Maurer
  • 2,480
  • 6
  • 18
  • 25