Skip to content

Commit c813444

Browse files
author
Em01
committed
more redux
1 parent f29ffdf commit c813444

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

es6/syntax.js

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ var myFunction = function(a, b) {
99
//es6
1010

1111
var myFunction = (a, b) => {return a + b};
12+
13+
//template strings
14+
var a = 1
15+
console.log(`i am a template string ${a})`);

redux/actions.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@
3030
};
3131
}
3232

33-
33+
//dont mutate arrays
34+
export default function(state = [], action){
35+
switch(action.type) {
36+
case 'ONE':
37+
// return state.concat([action.payload.data])
38+
return [ action.payload.data, ...state]
39+
}
40+
}

redux/middleware.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* Functions that take an action.
2+
* Act like a gatekeeper
3+
* They can let the action flow through or they can choose to manipulate
4+
* All actions flow through the middleware before hitting the reducer
5+
*
6+
* Can have as many different steps of middleware as we want.
7+
*
8+
* */
9+

0 commit comments

Comments
 (0)