I am trying to use the DatePicker component from MUI version 5. I have included it exactly as it is specified in the codesandbox example from the MUI docs. So my component looks like this:
const MonthPicker: FC = () => {
const [value, setValue] = React.useState<Date | null>(new Date());
return (
<LocalizationProvider dateAdapter={AdapterDateFns}>
<DatePicker
views={['year', 'month']}
label="Year and Month"
minDate={new Date('2012-03-01')}
maxDate={new Date('2023-06-01')}
value={value}
onChange={(newValue) => {
setValue(newValue);
}}
renderInput={(props) => <TextField {...props} size='small' helperText={null} />}
/>
</LocalizationProvider>
)
}
No matter what I tried, I always got the error message: React does not recognize the renderInput prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase renderinput instead.
If I write it in lowercase, then the code doesn't even render. What am I doing wrong here?
