SOURCE

// 1
const counter = (state = 0, action) => {
  switch (action.type) {
  case 'INCREMENT':
    return state + 1;
  case 'DECREMENT':
    return state - 1;
  default:
    return state;
  }
}
const {
  createStore
} = Redux;
const store = createStore(conter);

const render = () => {
  document.body.innerText = sotre.getState();
}

store.subscribe(render);

render();

document.addEventListener(‘click’, () => {
  store.dispatch({
    type: 'INCREMENT'
  })
})
console 命令行工具 X clear

                    
>
console