1.4 KiB
1.4 KiB
id, title, challengeType, isRequired, forumTopicId, localeTitle
id | title | challengeType | isRequired | forumTopicId | localeTitle |
---|---|---|---|---|---|
5a24c314108439a4d403614e | Define an Action Creator | 6 | false | 301441 | 定义一个 Action Creator |
Description
Instructions
actionCreator()
的函数,该函数在调用时返回action
对象。
Tests
tests:
- text: 函数<code>actionCreator</code>应该存在。
testString: assert(typeof actionCreator === 'function');
- text: 运行<code>actionCreator</code>函数应返回 action 对象。
testString: assert(typeof action === 'object');
- text: 返回的 action 应具有值为<code>LOGIN</code>的键值类型。
testString: assert(action.type === 'LOGIN');
Challenge Seed
const action = {
type: 'LOGIN'
}
// 在此处定义 action creator
Solution
const action = {
type: 'LOGIN'
}
// 在此处定义 action creator:
const actionCreator = () => {
return action;
};