full calendar react code example

Example 1: fullcalendar react add event duration

FullCalendar defaultView="dayGridMonth" dateClick={this.handleDateClick} select={this.handleSelectClick} selectable='true' plugins={[ dayGridPlugin, interactionPlugin ]}  events={[
                { title: 'event 1', allDay: true, start: '2020-05-29', end: '2020-05-30' },
                { title: 'event 2', allDay: true, start: '2020-05-29', end: '2020-05-30'}
            ]}/>

Example 2: fullcalendar react

import interactionPlugin from "@fullcalendar/interaction"; // needed for dayClick

export default class DemoApp extends React.Component {

  render() {
    return (
      <FullCalendar dateClick={this.handleDateClick} plugins={[ dayGridPlugin, interactionPlugin ]} />
    )
  }

  handleDateClick = (arg) => { // bind with an arrow function
    alert(arg.dateStr)
  }

}

Example 3: react full calendar

jsx<Datepicker
    controls={['calendar']}
    display="inline"
    touchUi={true}
 />

Example 4: fullcalendar react

@import '~@fullcalendar/core/main.css';
@import '~@fullcalendar/daygrid/main.css';

Example 5: fullcalendar react

import React from 'react'
import FullCalendar from '@fullcalendar/react'
import dayGridPlugin from '@fullcalendar/daygrid'

import './main.scss' // webpack must be configured to do this

export default class DemoApp extends React.Component {

  render() {
    return (
      <FullCalendar defaultView="dayGridMonth" plugins={[ dayGridPlugin ]} />
    )
  }

}