DateRange Picker as React Component
npm i react-date-range-picker
import React from 'react'
import { render } from 'react-dom'
import Datepicker from 'react-date-range-picker'
class Demo extends React.Component {
state = {
date: new Date().toLocaleString(),
}
onClick = date => {
this.setState({ date: date.toLocaleString() })
}
render() {
return (
<div className="demo">
<input type="text" name="date" className="demo__input" value={this.state.date} readOnly />
<Datepicker onClick={this.onClick} />
</div>
)
}
}
render(<Demo />, document.getElementById('app'))