Skip to content

Instantly share code, notes, and snippets.

@hadijaveed
Created May 28, 2017 22:14
Show Gist options
  • Save hadijaveed/b96b0b0d41a2a30143b621fd00ddb2ec to your computer and use it in GitHub Desktop.
Save hadijaveed/b96b0b0d41a2a30143b621fd00ddb2ec to your computer and use it in GitHub Desktop.
Vanilla Counter Example
let totalCount = 0;
let render = count => document.getElementById('count').innerHTML = count;
document.getElementById('increment')
.addEventListener('click', () => {
totalCount += 1;
render(totalCount);
});
document.getElementById('decerement')
.addEventListener('click', () => {
totalCount -= 1;
render(totalCount);
});
render(totalCount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment