2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Define an Action Creator
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Define an Action Creator
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
### Hint 1
|
|
|
|
|
|
|
|
A function is defined using the following syntax:
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
```javascript
|
|
|
|
function functionName() {
|
2018-10-12 15:37:13 -04:00
|
|
|
console.log("Do something");
|
|
|
|
}
|
2019-07-24 00:59:27 -07:00
|
|
|
```
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Where console.log can be changed as per the need.
|
|
|
|
|
|
|
|
### Hint 2
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
A value is returned using the ``` return ``` keyword
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
## Solutions
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
```javascript
|
|
|
|
function actionCreator() {
|
|
|
|
return action;
|
2018-10-12 15:37:13 -04:00
|
|
|
}
|
2019-07-24 00:59:27 -07:00
|
|
|
```
|
|
|
|
</details>
|