Skip to content

Instantly share code, notes, and snippets.

@intojs
Created November 21, 2020 00:38
Show Gist options
  • Save intojs/63175afceab2b96b21afeee316ab5762 to your computer and use it in GitHub Desktop.
Save intojs/63175afceab2b96b21afeee316ab5762 to your computer and use it in GitHub Desktop.
React MVC - Controller
class Controller {
#model;
initialize() {
this.#model = new Model();
const view = new View(this.#handleIncrementBtnClick);
this.#model.attach(view);
}
#handleIncrementBtnClick = () => {
this.#model.incrementCounter();
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment