|
12 | 12 | "description":"create a new `const reducers` and set it equal to\"reducer\". Pass\"reducers\" into your store for now, instead of\"reducer\". We'll use combineReducers shortly, but let's not break the app yet.",
|
13 | 13 | "tests": [
|
14 | 14 | "06/01"
|
| 15 | + ], |
| 16 | +"hints": [ |
| 17 | +"First, try this: `const reducers = reducer;`", |
| 18 | +"Second, try this: `const store = createStore(reducers, initialState);`" |
15 | 19 | ]
|
16 | 20 | },
|
17 | 21 | {
|
18 | 22 | "description":"We're going to create more than one reducer. They can't all be called\"reducer\", so rename your original reducer\"pokemon\". Make sure to set reducers equal to the new name as well.",
|
19 | 23 | "tests": [
|
20 | 24 | "06/02"
|
| 25 | + ], |
| 26 | +"hints": [ |
| 27 | +"First, rename\"pokemon\" to\"reducer\"", |
| 28 | +"Like this: `const pokemon = (state, action) => {...}`", |
| 29 | +"Second, change your\"reducers\" to equal\"pokemon\"", |
| 30 | +"Like this: `const reducers = pokemon;`" |
21 | 31 | ]
|
22 | 32 | },
|
23 | 33 | {
|
|
33 | 43 | "description":"combineReducers(), and pass in your reducer ({ pokemon })",
|
34 | 44 | "tests": [
|
35 | 45 | "06/04"
|
| 46 | + ], |
| 47 | +"hints": [ |
| 48 | +"Try this: ```const reducers = combineReducers({\n pokemon\n});\n```" |
36 | 49 | ]
|
37 | 50 | },
|
38 | 51 | {
|
39 |
| -"description":"create a\"defaultPokemon\"state", |
| 52 | +"description":"We're going to shake things up now to make our reducers more composable. Set the initialstate inside of your `createStore` to simply be an empty object (`{}`)", |
40 | 53 | "tests": [
|
41 | 54 | "06/05"
|
42 | 55 | ]
|
43 | 56 | },
|
44 | 57 | {
|
45 |
| -"description":"setthe initial state of thestore toanempty object", |
| 58 | +"description":"Thanks to `combineReducers` we can now definethe initial stateinsideofeach reducer. Get rid of\"initialState\", but keepthe\"pokemon\" key and call it\"defaultPokemon\". It should beanarray with three pokemon. Finally, pass the `defaultPokemon` as the default state in the pokemon reducer. You can use ES6 default params.", |
46 | 59 | "tests": [
|
47 | 60 | "06/06"
|
48 |
| - ] |
49 |
| - }, |
50 |
| - { |
51 |
| -"description":"pass the default state into the pokemon reducer", |
52 |
| -"tests": [ |
53 |
| -"06/07" |
| 61 | + ], |
| 62 | +"hints": [ |
| 63 | +"Like this:`const defaultPokemon = [{\n id: 1,\n name: 'Luvdisc',\n ...\n`", |
| 64 | +"Default params work like this: `fn(param1 = defaultParam, param2)`", |
| 65 | +"Like this: `const pokemon = (state = defaultPokemon, action) => {`" |
54 | 66 | ]
|
55 | 67 | },
|
56 | 68 | {
|
57 | 69 | "description":"We no longer pass the entire\"state\" inside of our reducers, only the slice of our state the reducer needs to know. Rename all references to\"state\" inside of your\"pokemon\" reducer to what it really is now:\"pokemon\".",
|
58 | 70 | "tests": [
|
59 |
| -"06/08" |
| 71 | +"06/07" |
60 | 72 | ]
|
61 | 73 | }
|
62 | 74 | ],
|
|