Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Last active May 8, 2017 11:53
Show Gist options
  • Save Arieg419/2d0ba6d03f855f5d489d814290e136e0 to your computer and use it in GitHub Desktop.
Save Arieg419/2d0ba6d03f855f5d489d814290e136e0 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Omer's Workshop</title>
<script src="https://unpkg.com/redux@latest/dist/redux.min.js"></script>
</head>
<body>
<div>
<p>
Counter: <span id="value">0</span> times
<button id="increment">+</button>
<button id="decrement">-</button>
<button id="incrementIfOdd">Increment if odd</button>
<button id="incrementAsync">Increment async</button>
</p>
</div>
<script>
function counter(state, action) {
}
var store = Redux.createStore(counter)
var valueEl = document.getElementById('value')
function render() {
valueEl.innerHTML = store.getState().toString()
}
render()
store.subscribe(render)
document.getElementById('increment')
.addEventListener('click', function () {
})
document.getElementById('decrement')
.addEventListener('click', function () {
})
document.getElementById('incrementIfOdd')
.addEventListener('click', function () {
})
document.getElementById('incrementAsync')
.addEventListener('click', function () {
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment