質問編集履歴
3
解決済みの箇所を削除
title
CHANGED
File without changes
|
body
CHANGED
@@ -165,7 +165,4 @@
|
|
165
165
|
|
166
166
|
【追記】 Storeの構造、型を調べるため```console.log(store.getState())```をindex.jsで実行したところ、コンソールの結果は次のようになりました。
|
167
167
|

|
168
|
-
確かにReducerは入っていて、それはmapStateToPropsでstate.userReducer.***として取り出せるはずと考えているのですが。
|
168
|
+
確かにReducerは入っていて、それはmapStateToPropsでstate.userReducer.***として取り出せるはずと考えているのですが。
|
169
|
-
|
170
|
-
|
171
|
-
当方react-routerでも躓いております。もしよければそちらの質問もご覧になって下さい。
|
2
タイトルの変更、追記
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
TypeScript&connected-react-router&thunk
|
1
|
+
mapStateToPropsが上手くいかない【TypeScript&connected-react-router&thunk】
|
body
CHANGED
@@ -163,5 +163,9 @@
|
|
163
163
|

|
164
164
|
|
165
165
|
|
166
|
+
【追記】 Storeの構造、型を調べるため```console.log(store.getState())```をindex.jsで実行したところ、コンソールの結果は次のようになりました。
|
167
|
+

|
168
|
+
確かにReducerは入っていて、それはmapStateToPropsでstate.userReducer.***として取り出せるはずと考えているのですが。
|
166
169
|
|
170
|
+
|
167
171
|
当方react-routerでも躓いております。もしよければそちらの質問もご覧になって下さい。
|
1
Store.jsの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -128,7 +128,27 @@
|
|
128
128
|
export default connect(mapStateToProps,{ logInIfFetchUser })(SignIn)
|
129
129
|
|
130
130
|
```
|
131
|
+
Store↓
|
132
|
+
```Storejs
|
133
|
+
import { createStore } from 'redux'
|
134
|
+
import { applyMiddleware } from "redux";
|
135
|
+
import thunk from 'redux-thunk';
|
136
|
+
import { createBrowserHistory } from 'history'
|
137
|
+
import { routerMiddleware } from 'connected-react-router'
|
138
|
+
import { rootReducer } from "./Reducers";
|
131
139
|
|
140
|
+
export const history = createBrowserHistory()
|
141
|
+
|
142
|
+
export const store = createStore(
|
143
|
+
rootReducer(history),
|
144
|
+
applyMiddleware(
|
145
|
+
routerMiddleware(history),
|
146
|
+
thunk
|
147
|
+
)
|
148
|
+
)
|
149
|
+
|
150
|
+
```
|
151
|
+
|
132
152
|
### 発生している問題・エラーメッセージ
|
133
153
|
|
134
154
|
mapStateToPropsの引数state(store)には確かにuserReducerが入っています。
|