StringInput fires change if state and props values do not match

Now it is also possible to call onChange listener if new value is empty string
This commit is contained in:
jirik committed 2017-01-16 15:12:03 +01:00
1 parent 07523c00f0
commit fab004cdfe
1 file changed
+1 -1
+1 -1
View File
@@ -27,7 +27,7 @@ class StringInput extends React.Component {
placeholder={this.props.default}
onChange={e => this.setState({ value: e.target.value })}
onBlur={() => {
if(this.state.value) this.props.onChange(this.state.value)
if(this.state.value!==this.props.value) this.props.onChange(this.state.value)
}}
/>
}