У меня есть следующий оператор Select в компоненте React
<Select
id="type"
className={classes.formComponent}
onChange={ e => handleDropDownListEvent(e) }
required
defaultValue="DEFAULT"
>
<option value="Opt1">Opt1</option>
<option value="Opt2">Opt2</option>
<option value="Opt3">
Opt3
</option>
<option defaultValue="DEFAULT" disabled>
Choose an event
</option>
</Select>
И когда я пытаюсь выбрать опцию в пользовательском интерфейсе из этого выпадающего списка, я получаю следующее предупреждение в chrome console:
index.js:1375 Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.
in option (at HealthKitForm.tsx:134)
in ul (created by ForwardRef(List))
in ForwardRef(List) (created by WithStyles(ForwardRef(List)))
in WithStyles(ForwardRef(List)) (created by ForwardRef(MenuList))
in ForwardRef(MenuList) (created by ForwardRef(Menu))
in div (created by ForwardRef(Paper))
in ForwardRef(Paper) (created by WithStyles(ForwardRef(Paper)))
in WithStyles(ForwardRef(Paper)) (created by Transition)
in Transition (created by ForwardRef(Grow))
in ForwardRef(Grow) (created by TrapFocus)
in TrapFocus (created by ForwardRef(Modal))
in div (created by ForwardRef(Modal))
in ForwardRef(Portal) (created by ForwardRef(Modal))
in ForwardRef(Modal) (created by ForwardRef(Popover))
in ForwardRef(Popover) (created by WithStyles(ForwardRef(Popover)))
in WithStyles(ForwardRef(Popover)) (created by ForwardRef(Menu))
in ForwardRef(Menu) (created by WithStyles(ForwardRef(Menu)))
in WithStyles(ForwardRef(Menu)) (created by ForwardRef(SelectInput))
in ForwardRef(SelectInput) (created by ForwardRef(InputBase))
in div (created by ForwardRef(InputBase))
in ForwardRef(InputBase) (created by WithStyles(ForwardRef(InputBase)))
in WithStyles(ForwardRef(InputBase)) (created by ForwardRef(Input))
in ForwardRef(Input) (created by WithStyles(ForwardRef(Input)))
in WithStyles(ForwardRef(Input)) (created by ForwardRef(Select))
in ForwardRef(Select) (created by WithStyles(ForwardRef(Select)))
in WithStyles(ForwardRef(Select)) (at HealthKitForm.tsx:128)
in form (at HealthKitForm.tsx:127)
in div (at HealthKitForm.tsx:125)
in HealthKitForm (at src/index.tsx:11)
in SmilerProvider (at src/index.tsx:10)
Что я делаю не так и как я могу решить это предупреждение? Также, какое событие генерируется, когда я выбираю опцию, потому что мне нужен тип события для подписи handleDropDownListEvent (event: type ???)