I used the response calendar library.
The default code suddenly gives an onChange prop error. What should I do? (It worked before.)
My code
`import React, {useState} from 'react'; import Calendar from "react-calendar";
function App() {
const [value, onChange] = useState(new Date());
return (
<div>
<Calendar
onChange={onChange}
value={value}
/>
</div>
);
}
export default App;`
Error message
TS2769: No overload matches this call. Overload 1 of 2, '(props: CalendarProps | Readonly): Calendar', gave the following error. Type 'Dispatch<SetStateAction>' is not assignable to type '(value: Value, event: MouseEvent<HTMLButtonElement, MouseEvent>) => void'. Types of parameters 'value' and 'value' are incompatible. Type 'Value' is not assignable to type 'SetStateAction'. Type 'null' is not assignable to type 'SetStateAction'. Overload 2 of 2, '(props: CalendarProps, context: any): Calendar', gave the following error. Type 'Dispatch<SetStateAction>' is not assignable to type '(value: Value, event: MouseEvent<HTMLButtonElement, MouseEvent>) => void'.
I checked npm version, config files and re-install. But it still don't working.