I'm trying to change 'myError' to true when MUI DateTimePicker throws onError but it doesn't work. The whole code itself is correct because when I change
() => {setValue({
...value,
myError: true
to alert('something') it works. I want to use this myError variable to manage submit button - disable it when an error occurs and enable it when it's not.
const [value, setValue] = useState({
myError: false,
})
<DateTimePicker
onError = {() => {setValue({
...value,
myError: true
}) }}
/>
Any ideas what should I change?