I have a react component and I want to know how can I trigger a click event on it by clicking an image in my case. I tried with React's useRef(), but it doesn't work. Any idea how can I do this ? My code is bellow
import { SingleDatePicker } from 'react-dates';
<SingleDatePicker
date={dateEnd}
onDateChange={dateEnd => handleDateEnd( dateEnd )}
focused={this.state.focusedEnd}
onFocusChange={({ focused }) => this.setState({ focusedEnd : focused })}
id="dateEndSearchBar"
/>
<img
src={calendarIcon}
onClick={//here I want to trigger the click on SingleDatePicker}
/>