/react-calendar

React.js Calendar Component

Primary LanguageJavaScriptMIT LicenseMIT

react-calendar

React calendar component inspired by CLNDR.js.

$ npm install react-calendar-component

See the demo

http://hanse.github.io/react-calendar/

import React, { Component } from 'react';
import { render } from 'react-dom';
import { Calendar } from 'react-calendar-component';
import moment from 'moment';
import 'moment/locale/nb';

class CalendarExample extends Component {
  state = {
    date: moment()
  }

  render() {
    return (
      <Calendar
        onNextMonth={() => this.setState({ date: this.state.date.clone().add(1, 'months') }) }
        onPrevMonth={() => this.setState({ date: this.state.date.clone().subtract(1, 'months') }) }
        date={this.state.date}
        onPickDate={(date) => console.log(date)}
      />
    );
  }
}

render(
  <CalendarExample />,
  document.getElementById('calendar')
);

License

MIT