Skip to content

Commit c4d46db

Browse files
committed
step 7 tasks and tests
1 parent b54d673 commit c4d46db

File tree

9 files changed

+107
-406
lines changed

9 files changed

+107
-406
lines changed

README.md

Lines changed: 8 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
A [CodeRoad](https://coderoad.github.io) tutorial for learning Redux.
44

5+
<!-- @import('01') -->
6+
<!-- @import('02') -->
7+
<!-- @import('03') -->
8+
<!-- @import('04') -->
9+
<!-- @import('05') -->
10+
<!-- @import('06') -->
511
<!-- @import('08') -->
612
<!-- @import('09') -->
713

@@ -22,85 +28,6 @@ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. L
2228

2329
## Outline
2430

25-
##### Project Setup
31+
##### File Structure
2632

27-
Getting a project setup is rarely easy. Luckily, we have a quick script that can do the work for us.
28-
29-
---
30-
31-
Running `> npm run setup` will do the following:
32-
33-
1. Install package dev dependencies
34-
2. Create an output directory called "dist"
35-
3. Install "concurrently" & "browser-sync" globally
36-
4. Run our app in the browser
37-
38-
You'll find this "setup" script located in your *package.json*.
39-
40-
41-
---
42-
43-
We'll be installing a lot of scripts from terminal. You may also want to consider installing the atom package ["platformio-ide-terminal"](https://github.com/platformio/platformio-atom-ide-terminal), which provides a terminal inside your editor.
44-
45-
##### The Store
46-
47-
The "single source of truth".
48-
49-
```js
50-
const store = createStore(reducer, initialState);
51-
```
52-
53-
##### Actions
54-
55-
Events that change the data.
56-
57-
##### 1. Actions
58-
```js
59-
const action = { type: 'ACTION_NAME' };
60-
```
61-
62-
##### 2. Action Creators
63-
64-
```js
65-
const actionName = () => ({ type: 'ACTION_NAME' });
66-
```
67-
68-
##### 3. Action Types
69-
70-
```js
71-
const ACTION_NAME = 'ACTION_NAME'
72-
```
73-
74-
##### Reducer
75-
76-
The data transformation
77-
78-
```js
79-
const reducer = (state) => {
80-
console.log(state);
81-
return state;
82-
};
83-
```
84-
85-
##### Pure Functions
86-
87-
Reducers must be pure functions
88-
89-
State is "read only".
90-
91-
Notes
92-
```js
93-
const nextPokemon = state.pokemon.map(p => {
94-
if (id === p.id) {
95-
p.votes += 1;
96-
}
97-
return p;
98-
});
99-
return {
100-
pokemon: nextPokemon
101-
};
102-
```
103-
104-
##### Combine Reducers
105-
106-
Create modular, composable reducers with `combineReducers`.
33+
Refactor your project into different files.

0 commit comments

Comments
 (0)