perf: improve dropdowns

This commit is contained in:
David Ralph
2021-03-23 12:23:21 +00:00
parent f3eb2c4cdb
commit b4e1d00633
7 changed files with 45 additions and 55 deletions

View File

@@ -9,7 +9,7 @@ export default class Dropdown extends React.PureComponent {
}
getLabel() {
return this.props.label ? <label htmlFor={this.props.name}>{this.props.label}</label> : null;
return this.props.label ? <label>{this.props.label}</label> : null;
}
onChange(value) {
@@ -28,11 +28,9 @@ export default class Dropdown extends React.PureComponent {
return (
<>
{this.getLabel()}
<div className='dropdown' style={{ display: 'inline' }}>
<select name={this.props.name} value={this.state.value} onChange={(e) => this.onChange(e.target.value)}>
{this.props.children}
</select>
</div>
<select value={this.state.value} onChange={(e) => this.onChange(e.target.value)}>
{this.props.children}
</select>
</>
);
}