Take advantage of transform-class-properties and use arrow functions instead of bind

This commit is contained in:
Loïc Gasser
2018-08-22 21:09:37 -04:00
parent 98c235bc21
commit e4de101553
20 changed files with 93 additions and 126 deletions

View File

@@ -49,7 +49,7 @@ class NumberInput extends React.Component {
return true
}
resetValue() {
resetValue = () => {
// Reset explicitly to default value if value has been cleared
if(this.state.value === "") {
return this.changeValue(this.props.default)
@@ -72,7 +72,7 @@ class NumberInput extends React.Component {
placeholder={this.props.default}
value={this.state.value}
onChange={e => this.changeValue(e.target.value)}
onBlur={this.resetValue.bind(this)}
onBlur={this.resetValue}
/>
}
}