¡Esta es una revisión vieja del documento!
import { createStore } from 'redux'; // Forbids to change the object structure const initialState = Object.freeze({ title: 'Beautiful Code', author: 'Douglas Crockford' }); // State updater function reducer(book = initialState, action) { switch (action.type) { case 'CHANGE_BOOK_TITLE': return { ...book, title: action.title } default: return book } } // Events listener that occour on the state const store = createStore(reducer); store.subscribe(function(){ console.log(store.getState()); }); // Dispatch changes on the state store.dispatch({ type: 'CHANGE_BOOK_TITLE', title: 'JavaScript The Best Parts' }); store.dispatch({ type: 'CHANGE_BOOK_TITLE', title: 'How JavaScript Works' });