JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://amatiasq.com/fiddle-console.js"></script>
JavaScript 1.7
import { createStore } from "redux";
cons = counter = (state = 0, action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
cons { createStore } = Redux;
cons store = createStore(counter);
cons render = () => {
document.body.innerText = store.getState();
};
store.subscribe(render);
render();
document.addEventListener('click', () => {
store.dispatch({ type: 'INCREMENT' });
})