I need to use the MUI Input API props and CSS for {error} and its use.
My code looks like this:
const [value, setValue] = useState<string>(cell.value);
const [startAdornment, setStartAdornment] = useState<adornmentTypes>("");
const [endAdornment, setEndAdornment] = useState<adornmentTypes>("");
const [error, seterror] = useState<error>(false);
<Input
id={id}
value={value}
onChange={_onChange} //have a method
onBlur={_onBlur} //have a method
onFocus={_handleFocus} //have a method
startAdornment={startAdornment} //have switch cases on special character $,% etc
endAdornment={endAdornment}
error={error} />
Now as per material docs error - bool - If true, the input will indicate an error. This is normally obtained via context from FormControl.
And for pseudo class error - .Mui-error - Pseudo-class applied to the root element if error={true}.
Now I can't get around to use the error state to true because of value type described as a string!
What am I missing? Please help!