|
277 | 277 | "description": "In Redux, we are not limited to writing a long, single reducer. Using `combineReducers` allows us to create modular, composable reducers.\n\nAs our state is an object, for example:\n\n```js\n{\n pokemon: [ ... ],\n users: [ ... ]\n}\n```\n\nWe can create a reducer to handle data transformations for each key in our state.\n\n```js\n{\n pokemon: pokemonReducer,\n users: usersReducer\n}\n```\n\nAs our app grows, we can now think of the data in smaller chunks.\n\n> [Learn more](http://redux.js.org/docs/api/combineReducers.html).\n\nLet's try refactoring our app to use `combineReducers`.",
|
278 | 278 | "tasks": [
|
279 | 279 | {
|
280 |
| - "description": "create a new `const reducers` and set it equal to \"reducer\". Pass \"reducers\" into your store for now, instead of \"reducer\". If this seems convoluted it is because we're trying not to break the app.", |
| 280 | + "description": "create a new `const reducers` and set it equal to \"reducer\". Pass \"reducers\" into your store for now, instead of \"reducer\". If this seems convoluted it is because we're trying not to break the app. Also comment out any `store.dispatch`'s until the change is complete.", |
281 | 281 | "tests": [
|
282 | 282 | "06/01"
|
283 | 283 | ],
|
|
351 | 351 | ]
|
352 | 352 | },
|
353 | 353 | {
|
354 |
| - "description": "`reducers` should now call `combineReducers` instead and call `pokemon`. `combineReducers` takes an object with keys of each reducer.", |
| 354 | + "description": "`reducers` should now call `combineReducers` instead and call `pokemon`. `combineReducers` takes an object with keys of each reducer. See the [docs](http://redux.js.org/docs/api/combineReducers.html).", |
355 | 355 | "tests": [
|
356 | 356 | "06/08"
|
357 | 357 | ],
|
358 | 358 | "hints": [
|
359 |
| - "Try this: `const reducers = combineReducers({pokemon});`" |
| 359 | + "Try this: `const reducers = combineReducers({ pokemon });`" |
360 | 360 | ]
|
361 | 361 | }
|
362 | 362 | ],
|
|
367 | 367 | "description": "Our \"index.js\" file is getting a little long. Of course, our app will be more maintainable if we can divide it across different, well structured files.\n\nThere are different ways of structuring your app:\n\n##### 1. Files By Type\n\n- store.js\n- action-types.js\n- action-creators.js\n- reducers.js\n\n##### 2. Files By Function\n\n- store.js\n- reducers.js\n- modules\n - pokemon\n - index.js\n\n##### 3. Files by Function & Type\n\n- store\n- reducers.js\n- modules\n - pokemon\n - actions.js\n - reducer.js\n - action-types.js\n\nFor simplicity in this example, we'll try putting our files together by function.",
|
368 | 368 | "tasks": [
|
369 | 369 | {
|
370 |
| - "description": "create a folder in your base directory called \"pokemon\" and add a file inside called \"index.js\"", |
| 370 | + "description": "create a new folder in your \"src\" directory called \"pokemon\" and add a file inside called \"index.js\"", |
371 | 371 | "tests": [
|
372 | 372 | "07/01"
|
373 | 373 | ],
|
|
401 | 401 | "07/04"
|
402 | 402 | ],
|
403 | 403 | "hints": [
|
404 |
| - "Try this: `import { voteUp } from './pokemon';`" |
| 404 | + "Try this: `const voteUp = require('./pokemon').voteUp;`" |
405 | 405 | ]
|
406 | 406 | },
|
407 | 407 | {
|
|
422 | 422 | "07/07"
|
423 | 423 | ],
|
424 | 424 | "hints": [
|
425 |
| - "Try this: `import { default as pokemon, voteUp } from './pokemon';`" |
| 425 | + "Normally we write this: `const { default as pokemon, voteUp } from './pokemon';`", |
| 426 | + "Due to a current issue in CodeRoad, we must write: `const pokemon = require('./pokemon').default;`" |
426 | 427 | ]
|
427 | 428 | }
|
428 | 429 | ],
|
429 |
| - "onPageComplete": "Page 7 complete..." |
| 430 | + "onPageComplete": "Now that our project is more organized, we'll look at one of the most powerful features of Redux: middleware" |
430 | 431 | },
|
431 | 432 | {
|
432 | 433 | "title": "Logger",
|
|
0 commit comments