質問編集履歴
3
疑問点にコメント入れた
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,9 +3,24 @@
|
|
3
3
|
ちなみにこれは[react-redux](https://github.com/gaearon/redux-thunk/blob/master/src/index.js)のコードを見ております。
|
4
4
|
|
5
5
|
arrow関数が連続で使用されている場合どの順番で評価されて行くのか理解できないです。
|
6
|
+
```
|
7
|
+
function createThunkMiddleware(extraArgument) {
|
8
|
+
//このreturnでarrow関数を呼び出してnextもactionも多分関数なのでしょうか?どのようにかんがえたらよいのか。。。
|
9
|
+
return ({ dispatch, getState }) => next => action => {
|
10
|
+
if (typeof action === 'function') {
|
11
|
+
return action(dispatch, getState, extraArgument);
|
12
|
+
}
|
6
13
|
|
7
|
-
|
14
|
+
return next(action);
|
15
|
+
};
|
16
|
+
}
|
8
17
|
|
18
|
+
const thunk = createThunkMiddleware();
|
19
|
+
thunk.withExtraArgument = createThunkMiddleware;
|
20
|
+
|
21
|
+
export default thunk;
|
22
|
+
```
|
23
|
+
|
9
24
|
上のコードの2行目のところが何をやっているのかわからなくて困ってます。
|
10
25
|
|
11
26
|
ES5風に書くと
|
2
わからない点を明確にした
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
ちなみにこれは[react-redux](https://github.com/gaearon/redux-thunk/blob/master/src/index.js)のコードを見ております。
|
4
4
|
|
5
|
+
arrow関数が連続で使用されている場合どの順番で評価されて行くのか理解できないです。
|
5
6
|
|
6
7
|

|
7
8
|
|
1
文章にミス
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
コードがわからなくて困っております。
|
2
2
|
|
3
|
-
ちなみにこれは
|
3
|
+
ちなみにこれは[react-redux](https://github.com/gaearon/redux-thunk/blob/master/src/index.js)のコードを見ております。
|
4
4
|
|
5
5
|
|
6
6
|

|