--- id: 5a24c314108439a4d403614e title: Define an Action Creator challengeType: 6 isRequired: false videoUrl: '' localeTitle: 定义一个Action Creator --- ## Description
创建操作后,下一步是将操作发送到Redux存储,以便它可以更新其状态。在Redux中,您可以定义动作创建器来完成此任务。动作创建者只是一个返回动作的JavaScript函数。换句话说,动作创建者创建表示动作事件的对象。
## Instructions
定义一个名为actionCreator()的函数,该函数在调用时返回action对象。
## Tests
```yml tests: - text: 函数actionCreator应该存在。 testString: 'assert(typeof actionCreator === "function", "The function actionCreator should exist.");' - text: 运行actionCreator函数应该返回操作对象。 testString: 'assert(typeof action === "object", "Running the actionCreator function should return the action object.");' - text: 返回的操作应具有值为LOGIN的键属性类型。 testString: 'assert(action.type === "LOGIN", "The returned action should have a key property type with value LOGIN.");' ```
## Challenge Seed
```jsx const action = { type: 'LOGIN' } // Define an action creator here: ```
## Solution
```js // solution required ```