Using react datepicker, I am trying to get the id of the clicked component
<DatePicker
id={cellData.column}
selected={DatePickerDate}
onChange={this.onDateRangePickerChange}
className='form-control'
/>
In my click handler the event being passed is a moment date object, so event.currentTarget
is undefined.
onDateRangePickerChange: function(event, picker){
var localRowDataStack = _.cloneDeep(this.state.rowDataStack);
localRowDataStack[event.currentTarget.id] = picker.startDate.format(appConfig.getKey('dateFormat'));
this.setState({
rowDataStack: localRowDataStack,
isOmitReRender: false
});
},
How can I get the id of the clicked datepicker?