Getting react-big-calendar to work.


Recently, a popular React calendar library (react-big-calendar) went through an upgrade which introduced breaking changes and made many of the online tutorials and documentation irrelevant.

The breaking change comes from the fact that BigCalendar is no longer an item being exported from the API (link to GitHub change). It took me some time of digging around to realize why I was getting major “undefined” errors while trying to get the most basic version of the calendar working. As of writing this, even the demo website has outdated code examples. I hope this code saves you some time.

The code: #

This calendar demo uses react-big-calendar version 0.22.0 and moment.js version 2.24.0.

Here is a link to a code sandbox with a working demo.

import React, { Component } from 'react';
import { render } from 'react-dom';
import { Calendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';
import 'react-big-calendar/lib/css/react-big-calendar.css';

const localizer = momentLocalizer(moment);

class App extends Component {
  constructor() {
    const now = new Date();
    const events = [
          id: 0,
          title: 'All Day Event very long title',
          allDay: true,
          start: new Date(2019, 6, 0),
          end: new Date(2019, 6, 1),
          id: 1,
          title: 'Long Event',
          start: new Date(2019, 3, 7),
          end: new Date(2019, 3, 10),
          id: 2,
          title: 'Right now Time Event',
          start: now,
          end: now,
    this.state = {

  render() {
    return (
        <div style={{ height: '500pt'}}>

render(<App />, document.getElementById('root'));

Things to keep in mind #

It appears as though the font on the calendar doesn’t exactly match the calendar on the demo website. You will need to create your own CSS rules for the fonts you would like on the calendar.

The other thing to keep in mind (which isn’t mentioned on the documentation) is that you need to provide a fixed height (in the above case height: '500pt') for the parent element of the calendar otherwise the month view shrinks and breaks.


Now read this

Your javascript webapps don’t actually need javascript.

Daniel Ricciardo doesn’t have anything to do with this article. Tl;dr: I made my personal website almost twice as fast by porting it from Nuxt to Astro. I made it so that zero JavaScript is sent to the browser[1] . Some background # I... Continue →