1.6 KiB
1.6 KiB
id | title | challengeType | isRequired | videoUrl | localeTitle |
---|---|---|---|---|---|
5a24c314108439a4d403614e | Define an Action Creator | 6 | false | 定义一个Action Creator |
Description
Instructions
actionCreator()
的函数,该函数在调用时返回action
对象。 Tests
tests:
- text: 函数<code>actionCreator</code>应该存在。
testString: 'assert(typeof actionCreator === "function", "The function <code>actionCreator</code> should exist.");'
- text: 运行<code>actionCreator</code>函数应该返回操作对象。
testString: 'assert(typeof action === "object", "Running the <code>actionCreator</code> function should return the action object.");'
- text: 返回的操作应具有值为<code>LOGIN</code>的键属性类型。
testString: 'assert(action.type === "LOGIN", "The returned action should have a key property type with value <code>LOGIN</code>.");'
Challenge Seed
const action = {
type: 'LOGIN'
}
// Define an action creator here:
Solution
// solution required