refactor: cleanup

This commit is contained in:
David Ralph
2021-03-23 13:10:34 +00:00
parent b4e1d00633
commit b773f256a4
33 changed files with 110 additions and 336 deletions

View File

@@ -1,8 +1,8 @@
import React from 'react';
export default class Dropdown extends React.PureComponent {
constructor(...args) {
super(...args);
constructor(props) {
super(props);
this.state = {
value: localStorage.getItem(this.props.name) || ''
};
@@ -12,7 +12,9 @@ export default class Dropdown extends React.PureComponent {
return this.props.label ? <label>{this.props.label}</label> : null;
}
onChange(value) {
onChange = (e) => {
const { value } = e.target;
this.setState({
value: value
});
@@ -28,7 +30,7 @@ export default class Dropdown extends React.PureComponent {
return (
<>
{this.getLabel()}
<select value={this.state.value} onChange={(e) => this.onChange(e.target.value)}>
<select value={this.state.value} onChange={this.onChange}>
{this.props.children}
</select>
</>