* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
1.1 KiB
1.1 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
5a24c314108439a4d403614c | 从 Redux Store 获取状态 | 6 | 301443 | get-state-from-the-redux-store |
--description--
Redux store 对象提供了几种允许你与之交互的方法,你可以使用getState()
方法检索 Redux store 对象中保存的当前的state
。
--instructions--
在代码编辑器中可以将上一个挑战中的代码更简洁地重写,在store
中使用store.getState()
检索state
,并将其分配给新变量currentState
。
--hints--
redux store 的 state 应该有一个初始值 5。
assert(store.getState() === 5);
应该存在一个变量currentState
,并为其分配 Redux store 的当前状态。
(getUserInput) =>
assert(
currentState === 5 && getUserInput('index').includes('store.getState()')
);
--seed--
--seed-contents--
const store = Redux.createStore(
(state = 5) => state
);
// Change code below this line
--solutions--
const store = Redux.createStore(
(state = 5) => state
);
// Change code below this line
const currentState = store.getState();