setState()

in apis/scaladoc-1.0.0/scripts/common/component.js [8:26]


  setState(nextState, cb = () => {}) {
    if (typeof nextState === "function") {
      this.state = {
        ...this.state,
        ...nextState(this.state),
      };
    } else {
      this.state = {
        ...this.state,
        ...nextState,
      };
    }

    cb();

    if (this.render) {
      this.render();
    }
  }