The onChange callback actually passes an array of selected dates, not a single one.
So to set the new state to the selected date, one has to only use the first element of the passed in value.
The current suggestion (desctructuring the parameter) is the one with the least changes, but may be difficult to understand for inexperienced users.
A more verbose but potentially more comprehensive way of writing this could be:
The onChange callback actually passes an array of selected dates, not a single one. So to set the new state to the selected date, one has to only use the first element of the passed in value.
The current suggestion (desctructuring the parameter) is the one with the least changes, but may be difficult to understand for inexperienced users. A more verbose but potentially more comprehensive way of writing this could be: