On selecting specific date in DatePicker component, getting error as 'handleChange is not a function' as mentioned above. DatePicker component is wrapped in Controller component of react-hook-form. Expected to display date on DatePicker input. How could it be resolved? See the code below:
<form noValidate autoComplete="off" onSubmit={handleSubmit(onSubmit)}>
<Controller
control={control}
name="date"
render={({ handleDateChange, selectedDate, ref }) => (
<>
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<Grid container justify="space-around">
<DatePicker
ref={ref}
value={selectedDate}
onChange={handleDateChange}
format={`d | ` + `MMMM | ` + `yyyy`}
disablePast
animateYearScrolling
margin="normal"
style={{ cursor: "pointer" }}
/>
</Grid>
</MuiPickersUtilsProvider>
<br />
</>
)}
rules={{
required: "Date is required"
}}
/>
</form>
Here is the CodeSandbox link: https://codesandbox.io/s/jolly-currying-lwtrj
Any suggestion or code changes is highly appreciated.