1.6 KiB
1.6 KiB
id | challengeType | forumTopicId | localeTitle |
---|---|---|---|
5a24c314108439a4d403614d | 6 | 301440 | 定义一个 Redux Action |
Description
type
属性,该属性表示此 action 的类型。
我们可以将 Redux action 视为信使,将有关应用程序中发生的事件信息提供给 Redux store,然后 store 根据发生的 action 进行状态的更新。
Instructions
action
并为它设置一个属性type
,并将他的值设置成字符串'LOGIN'
。
Tests
tests:
- text: 应该有一个 action 对象。
testString: assert((function() { return typeof action === 'object' })());
- text: 该 action 的值应该为<code>LOGIN</code>。
testString: assert((function() { return action.type === 'LOGIN' })());
Challenge Seed
// 在此处定义 action
Solution
const action = {
type: 'LOGIN'
}