I'm trying to add an onChange event handler to the Select component from material-ui:
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={values.country}
onChange={handleCountryChange}
>
{countries.map(c => {
return (
<MenuItem value={c}>{c}</MenuItem>
)
})}
</Select>
and my event handler:
const handleCountryChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
setValues({...values, country: event.target.value});
};
but I get the following error:
Type '(event: ChangeEvent) => void' is not assignable to type '(event: ChangeEvent<{ name?: string | undefined; value: unknown; }>, child: ReactNode) => void'.
What's wrong?