Getting Started with Redux, Batteries Included, No Assembly Required

Playing around with Redux this morning and didn’t like the fact that you have to use npm and whatnot to compile modules to run the simple example? Seemed overly complicated, so here’s a little demo with no compilation or development server required:

<!DOCTYPE html>
<script src=''></script>
<h1>Redux Quickstart<h1>
<h2>Count: <span id="counter">0</span></h2>
<button onclick="increment();">+</button>
<button onclick="decrement();">-</button>
function changeState(state = 0, action) {
switch(action.type) {
return state + 1;
return state - 1;
return state;
let store = Redux.createStore(changeState);
store.subscribe( () => {
document.getElementById('counter').innerHTML = store.getState();
function increment() {
store.dispatch({ type: 'INCREMENT' });
function decrement() {
store.dispatch({ type: 'DECREMENT' });