import React from 'react';
import DatePickerDialog from 'material-ui/DatePicker/DatePickerDialog';
export default class SomeComponent extends React.Component {
constructor(props, context) {
super(props, context);
this.closeDatePicker = this.closeDatePicker.bind(this);
this.openDatePicker = this.openDatePicker.bind(this);
}
closeDatePicker() {
this.datePicker.dismiss();
}
openDatePicker() {
this.datePicker.show();
}
render() {
return (
<div>
<button onClick={this.openDatePicker}>Open</button>
<button onClick={this.closeDatePicker}>Close</button>
<DatePickerDialog ref={ref => this.datePicker = ref} />
</div>
);
}
}
export default function (state = innitialState, action) {
switch (action.type) {
case 'SELECT__DATE':
return Object.assign({}, state, {
date: state.date + action.payload,
});
break;
}
}