Skip to content

Instantly share code, notes, and snippets.

@hpneo
Created November 11, 2017 17:12
Show Gist options
  • Save hpneo/7bf3f351cfdd1efb9f0a92e331313fbb to your computer and use it in GitHub Desktop.
Save hpneo/7bf3f351cfdd1efb9f0a92e331313fbb to your computer and use it in GitHub Desktop.
import React from 'react';
import FullCalendar from 'fullcalendar';
class ReactFullCalendar extends React.Component {
componentDidMount() {
this.widget = $(this.container).fullCalendar({
currentDate: this.props.currentDate,
});
this.widget.on('dateSelected', this.props.onDateSelected);
}
componentDidUpdate() {
this.widget = $(this.container).fullCalendar({
currentDate: this.props.currentDate,
});
}
componentWillUnmount() {
this.widget.fullCalendar('destroy');
}
render() {
return <div ref={(div) => {this.container = div;}} />;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment