React DatePicker how to open datepicker on click of icon
reactjs, redux
Solution
Just wrap DatePicker with label. All click inside label call focus on input, that open calendar.
<label>
<DatePicker/>
</label>
Problem
Trying to open datepicker on click of icon of react-datepicker component, I have gone through their docs and issues links but found that its not much useful. ``` <DatePicker {...startDateOpts} id='abc' maxDate={moment()} onChange={this.handleStartChange} placeholderText='Start Date' popoverAttachment={smallScreen ? 'bottom center' : undefined} popoverTargetAttachment={smallScreen ? 'top center' : undefined} popoverTargetOffset={smallScreen ? '0px 0px' : undefined} /> ``` I tried from React-datepicker docs link but no luck.