Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createHandler(path){
var self = this
, setpath = setter(path)
return function(val){
var s = self.state; // copy state so we can update without mutating
if( val && val.target) // in case we got a `SyntheticEvent` object
val = val.target.value
setpath(s, val === null ? undefined : val) // i don't want to allow nullable values so coerce to undefined
self.setState(s)
}
},
return val => {
if (val && val.target) // in case we got a `SyntheticEvent` object; react-widgets pass the value directly to onChange
val = val.target.value
setter(path)(this.state, val)
this.setState(this.state, () => this._runValidations())
}
}
return val => {
if (val && val.target) // in case we got a `SyntheticEvent` object; react-widgets pass the value directly to onChange
val = val.target.value
setter(path)(this.state, val)
this.setState(this.state, () => this._runValidations())
}
}