Closed gpltaylor closed 7 years ago
try selected
attribute, it can work
<option value="0" key="0">zero</option>
<option value="1" key="1">1</option>
<option selected={typeValue === 2} value="2" key="2">2</option>
<option value="3" key="3">3</option>
<option value="4" key="4">4</option>
An Option
component will be better
function Option({ value, select, children }) {
return <option selected={value === select} value={value}>{children}</options>
}
Hi @Lucifier129 thank you for your response. We have implemented this solution, however, we get React warning to use value or defaultValue within the select tag.
Do you think that React/lite will remove support for this? I want to limit technical debt for upgrading.
@gpltaylor No, selected
is a native dom property, I think react and react-lite will always support this feature.
Thanx @Lucifier129 I will implement this shortcut. Will react-lite be updated to support this or do you want me to close this issue? It's working in some browsers and is a bug in React-lite (IMO)...
Yeah, it is a bug of react-lite, let's keep this issue open until it has been resolved~
Ta, and thank you for the effort you put into this project. 👍
Hi @Lucifier129 I have submitted a pull request https://github.com/Lucifier129/react-lite/pull/127
When using "select" tag, the selected option is not displayed. This works in Chrome, but not IE or Edge.
Expected Dropdown to show with the selected value picked in Edge or IE.
Actual The first item is selected
Example https://jsfiddle.net/xy99xexh/3/