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

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

The 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