I'm using the useLocation hook like this -> const location = useLocation();. Then I try to pass it to the prop of a React element like this:
<DatePicker
emphasize={location.state?.fields?.some(
(f: string) => f === 'endDate'
)}
data-testid="collection-form-end-date"
type="datetime-local"
{...field}
/>
But I get the location.state underscored and the following error -> Object is of type 'unknown'.