const store = createStore((state = { counter: 0 }, action) => { switch(action.type) { case "INCREMENT": return { counter: state.counter + 1 } case "DECREMENT": return { counter: state.counter - 1 } default: return state } }) store.dispatch({ type: "INCREMENT" }) store.dispatch({ type: "INCREMENT" }) console.log(store.getState())