import React, { Component } from 'react';

class Module extends Component {
  constructor(props) {
    super(props);
    this.init = false;
    this.state = {};
  }

  initState(state) {
    this.state = Object.assign(this.state, state);
  }

  restart() {
    this.init = false;
  }

  componentWillMount() {
    this.initData();
    this.init = true;
  }

  componentWillUpdate() {
    if (this.init) {
      this.updateData();
    } else {
      this.initData();
      this.init = true;
    }
  }

  componentWillUnmount() {}

  initData() {}

  updateData() {}

  render() {
    return this.renderView();
  }

  renderView() {
    return <div />;
  }
}
export default Module;
