Skip to content

Commit a993913

Browse files
committed
final check steps 3-4
1 parent 4a2e64a commit a993913

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

coderoad.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"description": "An **action** is a named event that can trigger a change in your application data.\n\nActions are often broken into three parts to make your code more readable.\n\n##### 1. Actions\n\nAn **action** includes a named \"type\".\n```js\nconst action = { type: 'ACTION_NAME' };\n```\n\nActions may also include other possible params needed to transform that data.\n\n```js\nconst getItem = { type: 'GET_ITEM', clientId: 42, payload: { id: 12 } };\n```\n\nNormal params passed in are often put inside of a `payload` object. This is part of a standard called [Flux Standard Action](https://github.com/acdlite/flux-standard-action). Other common fields include `error` & `meta`.\n\n##### 2. Action Creators\n\nAn **action creator** is a functions that creates an action.\n\n```js\nconst actionName = () => ({ type: 'ACTION_NAME' });\n```\n\nAction creators make it easy to pass params into an action.\n\n```js\nconst getItem = (clientId, id) => ({ type: 'GET_ITEM', clientId: 42, payload: { id: 12 } });\n```\n\n##### 3. Action Types\n\nOften, the action name is also extracted as an **action type**. This is helpful for readability and to catch action name typos. Additionally, most editors will auto-complete your action types from the variable name.\n\n```js\nconst ACTION_NAME = 'ACTION_NAME';\nconst GET_ITEM = 'GET_ITEM';\n\nconst action = () => ({ type: ACTION_NAME });\nconst getItem = (id) => ({ type: GET_ITEM, payload: { id }});\n```\n\n> [Learn more](http://redux.js.org/docs/basics/Actions.html).\n\nLet's write an action for voting up your choice of worst pokemon.",
117117
"tasks": [
118118
{
119-
"description": "create an action called `voteUp` and a type of 'VOTE_UP'",
119+
"description": "create an action called `voteUp`. It should be an object with a type of 'VOTE_UP'",
120120
"tests": [
121121
"03/01"
122122
],
@@ -167,7 +167,7 @@
167167
"description": "A **reducer** is what handles the actual data transformation triggered by an action.\n\nIn it's simplest form, a **reducer** is just a function with the current **state** and current **action** passed in.\n\n```js\nconst reducer = (state, action) => {\n console.log(state);\n return state;\n};\n```\n\nWe can handle different actions by matching on the action type. If no matches are found, we just return the original state.\n\n```js\nconst ACTION_NAME = 'ACTION_NAME';\n\nconst reducer = (state, action) => {\n switch(action.type) {\n // match on action.type === ACTION_NAME\n case ACTION_NAME:\n state = 42;\n // return new state after transformation\n return state;\n default:\n return state;\n }\n};\n```\n\nOur reducer is passed in as the first param when we create our **store**.\n\n> [Learn more](http://redux.js.org/docs/basics/Reducers.html).",
168168
"tasks": [
169169
{
170-
"description": "Extract the `state => state` function called by `createStore`, and declare it with a variable called \"reducer\".",
170+
"description": "Extract the `state => state` function called by `createStore`, and declare it as a variable called \"reducer\".",
171171
"tests": [
172172
"04/01"
173173
],

tutorial/03/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const getItem = (id) => ({ type: GET_ITEM, payload: { id }});
4848
4949
Let's write an action for voting up your choice of worst pokemon.
5050

51-
+ create an action called `voteUp` and a type of 'VOTE_UP'
51+
+ create an action called `voteUp`. It should be an object with a type of 'VOTE_UP'
5252
@test('03/01')
5353
@action(open('src/index.js'))
5454

tutorial/04/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Our reducer is passed in as the first param when we create our **store**.
3232

3333
> [Learn more](http://redux.js.org/docs/basics/Reducers.html).
3434
35-
+ Extract the `state => state` function called by `createStore`, and declare it with a variable called "reducer".
35+
+ Extract the `state => state` function called by `createStore`, and declare it as a variable called "reducer".
3636
@test('04/01')
3737
@action(open('src/index.js'))
3838
@hint('Try this: `const reducer = state => state;`')

0 commit comments

Comments
 (0)