You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
-
conststore=createStore(reducer, initialState);
51
-
```
52
-
53
-
##### Actions
54
-
55
-
Events that change the data.
56
-
57
-
##### 1. Actions
58
-
```js
59
-
constaction= { type:'ACTION_NAME' };
60
-
```
61
-
62
-
##### 2. Action Creators
63
-
64
-
```js
65
-
constactionName= () => ({ type:'ACTION_NAME' });
66
-
```
67
-
68
-
##### 3. Action Types
69
-
70
-
```js
71
-
constACTION_NAME='ACTION_NAME'
72
-
```
73
-
74
-
##### Reducer
75
-
76
-
The data transformation
77
-
78
-
```js
79
-
constreducer= (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
-
constnextPokemon=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`.
0 commit comments