Reactjs 处于错误状态时,自动完成材质ui不显示错误

Reactjs 处于错误状态时,自动完成材质ui不显示错误,reactjs,autocomplete,material-ui,Reactjs,Autocomplete,Material Ui,如果自动完成输入字段有错误,我希望它以红色显示。我在renderInput中添加了错误道具,但它仍然不会显示错误状态。如何将其更改为错误状态 <Autocomplete popupIcon={null} noOptionsText={'No match found'} className={classes.auto} autoComplete disableClearable fullWid

如果自动完成输入字段有错误,我希望它以红色显示。我在renderInput中添加了错误道具,但它仍然不会显示错误状态。如何将其更改为错误状态

  <Autocomplete
        popupIcon={null}
        noOptionsText={'No match found'}
        className={classes.auto}
        autoComplete
        disableClearable
        fullWidth
        options={array || []}
        getOptionLabel={optionLabel}
        value={value || ''}
        onFocus={() => fetch(' ')}
        onChange={onChange}
        style={{ height: '100%' }}
        renderOption={renderOption}
        PopperComponent={(props) => (
          <Popper
            {...props}
            placement="bottom-start"
            style={{ width: desktop && '370px' }}
          />
        )}
        renderInput={(params) => (
          <CssTextField
            error = {hasError ? true : false}
            placeholder={capfirstLetter(placeholder)}
            style={{ height: '100%' }}
            {...params}
            variant="outlined"
            className={classes.input}
            fullWidth
            margin="normal"
            onChange={fetch ? (e) => fetch(e.target.value) : null}
            onFocus={(e) => handleOnFocus(e.target.value)}
          />
        )}
      />
fetch(“”)}
onChange={onChange}
样式={{height:'100%}}
renderOption={renderOption}
PopperComponent={(道具)=>(
)}
renderInput={(参数)=>(
获取(e.target.value):null}
onFocus={(e)=>handleOnFocus(e.target.value)}
/>
)}
/>