import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
const StyledTextField = styled(TextField)(({ theme }) => ({
'& .MuiInputBase-input': {
padding: '8px',
},
}));
const CustomDatePicker = () => (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
format='MM/DD/YYYY'
renderInput={(params: TextFieldProps) => <StyledTextField {...params} />}
/>
</LocalizationProvider>
);
I encountered an issue in the renderInput line of my code. The error message states:
Type '{ format: string; renderInput: (params: TextFieldProps) => Element; }' is not assignable to type 'IntrinsicAttributes & DatePickerProps<Dayjs, false> & RefAttributes'. Property 'renderInput' does not exist on type 'IntrinsicAttributes & DatePickerProps<Dayjs, false> & RefAttributes'.ts(2322)
Seeking guidance on how to resolve this error and understand its root cause.
Appreciate any assistance on this matter.