All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dotty_res.scripts.common.component.js Maven / Gradle / Ivy

There is a newer version: 3.6.0-RC1-bin-20240903-21a3d39-NIGHTLY
Show newest version
class Component {
  constructor(props = {}) {
    this.props = props;
    this.prevProps = {};
    this.state = {};
  }

  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();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy