I am trying to use react-hook-form with react-datepicker. I am using a button to open the datepicker, and trying to close it once the selection of a new date is made.
Below is the code-sandbox I made showing the exact problem I am facing.
https://codesandbox.io/p/sandbox/react-datepicker-spsrjs?file=%2Fsrc%2FDatePicker.js%3A92%2C13-92%2C21
The control is not even going to the onChange in the DatePicker component while trying to debug. The DatePicker component can only be closed by clicking again on the button.
Any help is much appreciated