My disabled state React selector doesn't show any default value
P粉464113078
P粉464113078 2024-02-17 20:53:10
0
1
417

I'm new to react and I'm having a hard time figuring out why my defaultValueAttributes doesn't display anything:

<Select
    id="my_disabled_select"
    name="my_disabled_select"
    disabled
    defaultValue={connectedUser.options[0]}
/>

I tried showing connectedUser.options[0] in the InputLabel tag and the value is defined!

Does anyone know why this happens and how to fix it?

P粉464113078
P粉464113078

reply all(1)
P粉320361201

You are missing the corresponding MenuItem child component so Select knows what to render.

Something like this should work:

See this ExampleStack Blitz

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!