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

@@ -27,14 +27,13 @@ class DynamicArrayInput extends React.Component {
return this.props.value || this.props.default || []
}
addValue() {
addValue = () => {
const values = this.values.slice(0)
if (this.props.type === 'number') {
values.push(0)
} else {
values.push("")
}
this.props.onChange(values)
}
@@ -77,7 +76,7 @@ class DynamicArrayInput extends React.Component {
{inputs}
<Button
className="maputnik-array-add-value"
onClick={this.addValue.bind(this)}
onClick={this.addValue}
>
Add value
</Button>