react-month-year-picker
v1.0.1
Published
ReactJs component for selecting month and year
Downloads
429
Readme
react-month-year-picker
ReactJs component for selecting month and year
Install
npm install --save react-month-year-picker
Usage
import React, { Component } from 'react';
import MonthYearPicker from 'react-month-year-picker';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
month: 10,
year: 2018,
};
}
render() {
return (
<div>
<MonthYearPicker
selectedMonth={this.state.month}
selectedYear={this.state.year}
minYear={2000}
maxYear={2030}
onChangeYear={year => this.setState({ year: year })}
onChangeMonth={month => this.setState({ month: month })}
/>
<h3>Selected month: {this.state.month}</h3>
<h3>Selected year: {this.state.year}</h3>
</div>
);
}
}
Run demo
npm run build
cd example
npm start
License
MIT © nclong87