state
inmutabilidad del state
, pero primero, aquí hay una revisión de todo lo que has aprendido hasta ahora. incAction
y decAction
, los decAction
acción counterReducer()
, INCREMENT
y DECREMENT
, y finalmente la store
Redux. Una vez que hayas terminado, deberías poder enviar acciones de INCREMENT
o DECREMENT
para incrementar o disminuir el estado que se tiene en la store
. Buena suerte construyendo tu primera aplicación de Redux! incAction
debe devolver un objeto acción con type
igual al valor de INCREMENT
testString: 'assert(incAction().type ===INCREMENT, "The action creator incAction
should return an action object with type
equal to the value of INCREMENT
");'
- text: La acción creadora decAction
debe devolver un objeto de acción con un type
igual al valor de DECREMENT
testString: 'assert(decAction().type === DECREMENT, "The action creator decAction
should return an action object with type
equal to the value of DECREMENT
");'
- text: La tienda Redux debería inicializarse con un state
de 0.
testString: 'assert(store.getState() === 0, "The Redux store should initialize with a state
of 0.");'
- text: El envío de incAction
en el almacén de Redux debería incrementar el state
en 1.
testString: 'assert((function() { const initialState = store.getState(); store.dispatch(incAction()); const incState = store.getState(); return initialState + 1 === incState })(), "Dispatching incAction
on the Redux store should increment the state
by 1.");'
- text: El envío de la decAction
en el almacén de Redux debería disminuir el state
en 1.
testString: 'assert((function() { const initialState = store.getState(); store.dispatch(decAction()); const decState = store.getState(); return initialState - 1 === decState })(), "Dispatching decAction
on the Redux store should decrement the state
by 1.");'
- text: counterReducer
debe ser una función
testString: 'assert(typeof counterReducer === "function", "counterReducer
should be a function");'
```