1.8 KiB
1.8 KiB
id | title | localeTitle | challengeType | isRequired |
---|---|---|---|---|
5a24c314108439a4d403614c | Get State from the Redux Store | Obtener el estado de la tienda redux | 6 | false |
Description
state
actual mantenido en el objeto de almacenamiento de Redux con el método getState()
.
Instructions
store.getState()
para recuperar el state
de la store
y asigne esto a una nueva variable currentState
.
Tests
tests:
- text: El almacén de redux debe tener un valor de 5 para el estado inicial.
testString: 'assert(store.getState()===5, "The redux store should have a value of 5 for the initial state.");'
- text: Debe existir una variable <code clase = "notranslate"> currentState </code> y debe asignársele el estado actual del almacén de Redux.
testString: 'getUserInput => assert(currentState === 5 && getUserInput("index").includes("store.getState()"), "A variable <code>currentState</code> should exist and should be assigned the current state of the Redux store.");'
Challenge Seed
const store = Redux.createStore(
(state = 5) => state
);
// change code below this line
Solution
const store = Redux.createStore(
(state = 5) => state
);
// change code below this line
const currentState = store.getState();