I Tried to Implement React Datepicker Function number 32 https://reactdatepicker.com/.
Here is the Documentation Code they provided
handleChange (date) {
this.setState({startDate: date})
this.toggleCalendar()
}
toggleCalendar (e) {
e && e.preventDefault()
this.setState({isOpen: !this.state.isOpen})
}
<div>
<button
className="example-custom-input"
onClick={this.toggleCalendar}
{format(this.state.startDate, "dd-MM-yyyy")}
</button>
{
this.state.isOpen && (
<DatePicker
selected={this.state.startDate}
onChange={this.handleChange}
withPortal
inline />
)
}
</div>
What My Problem is, "Format is not defined" error gets throwing.
what mistake i made here?
Please Help.