Skip to content

Instantly share code, notes, and snippets.

@intojs
Created November 21, 2020 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intojs/0f3f925999d355251361f3cf6916334e to your computer and use it in GitHub Desktop.
Save intojs/0f3f925999d355251361f3cf6916334e to your computer and use it in GitHub Desktop.
React MVC - View
class View {
#counterEl;
#incrementBtnEl;
constructor(incrementBtnClick) {
this.#counterEl = document.getElementById("counter");
this.#incrementBtnEl = document.getElementById("increment-button");
this.#incrementBtnEl.addEventListener("click", incrementBtnClick);
}
update(counter) {
this.#counterEl.innerHTML = `<div>${counter}</div>`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment