How to use the property-expr.setter function in property-expr

To help you get started, we’ve selected a few property-expr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jquense / react-input-message / example / dev.jsx View on Github external
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)
    }
  },
github jquense / react-input-message / example / input-validator-example.jsx View on Github external
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())
      }
    }
github jquense / react-input-message / dev / input-validator-example.jsx View on Github external
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())
      }
    }

property-expr

tiny util for getting and setting deep object props safely

MIT
Latest version published 10 months ago

Package Health Score

68 / 100
Full package analysis