Home > other >  Why does the Material-UI Select does not display any option?
Why does the Material-UI Select does not display any option?

Time:09-28

Hello I was changing all my selects to Material-UI Selects (because they look better in my opinion) , but I'm struggling because I'm looking at a tutorial and I have exactly the same settings but I don't see any of the options I have set up

enter image description here

const [escuela, setEscuela] = useState("");

const handleChange2 = (event) => {
      setEscuela(event.target.value);
    };

<Select className= "SelectMultiple" value = {escuela} label = "Seleccione Escuela..." onChange={handleChange2}>
<MenuItem value={"Academia Internacional de Boquete"}>Academia Internacional de Boquete</MenuItem>
<MenuItem value={"Academia Internacional de David"}>Academia Internacional de David</MenuItem>
</Select>

CodePudding user response:

You want to use MUI's Select but the Select in the screenshot is from react-select package. Both component name is Select so if you're migrating to the other library, you should use different default name to avoid mixing one with the other:

import ReactSelect from 'react-select'
import MuiSelect from '@mui/material/Select';
  • Related