79283121

Date: 2024-12-15 20:27:44
Score: 0.5
Natty:
Report link

For anybody who uses MUI 6+, InputProps is set as deprecated, and it should be replaced with slotProps with input property assigned an object with startAdornment and endAdornment as properties.

To fix this, replace the following snippet:

InputProps={{
  startAdornment: (
    <InputAdornment position="start">
      <SearchIcon />
    </InputAdornment>
  ),

  endAdornment: value && (
    <IconButton
      aria-label="toggle password visibility"
      onClick={() => setValue("")}
    ><CancelRoundedIcon/></IconButton>
  )
}}

With the following:

slotProps={{
  input: {
    startAdornment: (
      <InputAdornment position="start">
        <SearchIcon />
      </InputAdornment>
    ),
    endAdornment: value && (
      <IconButton
        aria-label="toggle password visibility"
        onClick={() => setValue("")}
      ><CancelRoundedIcon/></IconButton>
    )
  },
}}

For more info, please refer to this guide

Reasons:
  • Blacklisted phrase (1): this guide
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Abdul Rahman Kayali