1.6 KiB
1.6 KiB
id, title, challengeType, isRequired
| id | title | challengeType | isRequired |
|---|---|---|---|
| 5a24c314108439a4d403614c | Get State from the Redux Store | 6 | false |
Description
state held in the Redux store object with the getState() method.
Instructions
store.getState() to retrieve the state from the store, and assign this to a new variable currentState.
Tests
- text: The redux store should have a value of 5 for the initial state.
testString: 'assert(store.getState()===5, ''The redux store should have a value of 5 for the initial state.'');'
- text: A variable <code>currentState</code> should exist and should be assigned the current state of the Redux store.
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();