Fix Select value/selected React warning
Summary: React outputs the following error: Warning: Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>. This fixes it by using value instead of selected. Reviewed By: danielbuechele Differential Revision: D15535717 fbshipit-source-id: eb784ba2cdefe1c6744cc15592cd3e0191d237d0
This commit is contained in:
committed by
Facebook Github Bot
parent
79902cd7cb
commit
2221090037
@@ -698,7 +698,9 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
||||
obj[item] = item;
|
||||
return obj;
|
||||
}, {})}
|
||||
selected={String(this.state.selectedDatabase)}
|
||||
selected={
|
||||
this.state.databases[this.state.selectedDatabase - 1]?.name
|
||||
}
|
||||
onChange={this.onDatabaseSelected}
|
||||
/>
|
||||
<BoldSpan style={{marginLeft: 16, marginRight: 16}}>Table</BoldSpan>
|
||||
|
||||
@@ -56,9 +56,10 @@ export default class Select extends Component<{
|
||||
grow={grow}
|
||||
id={this.selectID}
|
||||
onChange={this.onChange}
|
||||
className={className}>
|
||||
className={className}
|
||||
value={selected || ''}>
|
||||
{Object.keys(options).map((key, index) => (
|
||||
<option key={index} selected={key === selected}>
|
||||
<option value={options[key]} key={index}>
|
||||
{options[key]}
|
||||
</option>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user