teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

4

質問の解答

2019/11/04 15:02

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -4,6 +4,19 @@
4
4
  他の原因はどこにあるでしょうか。
5
5
  わかる方がいましたら回答お願いします。
6
6
 
7
+ ### コンソール出力
8
+ ```
9
+ action @@router/CALL_HISTORY_METHOD @ 23:59:06.455
10
+ redux-logger.js:388 prev state {noop: {…}, shopping: {…}, Ranking: {…}, router: {…}}Ranking: {category: undefined, ranking: undefined, error: false}noop: {}router: {location: {…}, action: "POP"}shopping: {categories: Array(3)}__proto__: Object
11
+ redux-logger.js:392 action {type: "@@router/CALL_HISTORY_METHOD", payload: {…}}payload: {method: "push", args: Array(1)}args: ["/category/2502"]method: "push"__proto__: Objecttype: "@@router/CALL_HISTORY_METHOD"__proto__: Object
12
+ redux-logger.js:401 next state {noop: {…}, shopping: {…}, Ranking: {…}, router: {…}}Ranking: {category: undefined, ranking: undefined, error: false}noop: {}router: {location: {…}, action: "POP"}shopping: {categories: Array(3)}__proto__: Object
13
+ redux-logger.js:377 action @@router/LOCATION_CHANGE @ 23:59:06.457
14
+ redux-logger.js:388 prev state {noop: {…}, shopping: {…}, Ranking: {…}, router: {…}}
15
+ redux-logger.js:392 action {type: "@@router/LOCATION_CHANGE", payload: {…}}payload: {location: {…}, action: "PUSH", isFirstRendering: false}type: "@@router/LOCATION_CHANGE"__proto__: Object
16
+ redux-logger.js:401 next state {noop: {…}, shopping: {…}, Ranking: {…}, router: {…}}
17
+ ```
18
+
19
+
7
20
  ### 該当のソースコード
8
21
  createStore.js
9
22
  ```

3

質問の解答

2019/11/04 15:02

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -5,6 +5,35 @@
5
5
  わかる方がいましたら回答お願いします。
6
6
 
7
7
  ### 該当のソースコード
8
+ createStore.js
9
+ ```
10
+ import {
11
+ createStore as reduxCreateStore,
12
+ combineReducers,
13
+ applyMiddleware
14
+ } from 'redux';
15
+ import logger from 'redux-logger';
16
+ import thunk from 'redux-thunk';
17
+ import { connectRouter, routerMiddleware } from 'connected-react-router';
18
+
19
+ import * as reducers from './reducers';
20
+
21
+ export default function createStore(history) {
22
+ return reduxCreateStore(
23
+ combineReducers({
24
+ ...reducers,
25
+ router: connectRouter(history), //ルーター状態を管理するルーターreducer
26
+ }),
27
+ applyMiddleware(
28
+ logger,
29
+ thunk,
30
+ routerMiddleware(history)
31
+ )
32
+ );
33
+ }
34
+ ```
35
+
36
+
8
37
  index.js
9
38
  ```index.js
10
39
  import React from 'react';

2

変更

2019/11/04 14:52

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -187,4 +187,5 @@
187
187
 
188
188
  ###試したこと
189
189
  [https://github.com/supasate/connected-react-router/issues/260](https://github.com/supasate/connected-react-router/issues/260)
190
- 上記のサイトにバージョンを6.0.0にダウングレードさせるように記述されていましたが、試してみても変わりませんでした。
190
+ 上記のサイトにバージョンを6.0.0にダウングレードさせるように記述されていましたが、試してみても変わりませんでした。
191
+ react-router-domとconnected-react-routerが依存関係があるようで、上の記事に書かれている場合すべての通りを試してみましたが、変化なしです。

1

変更

2019/10/25 00:38

投稿

aiai8976
aiai8976

スコア112

title CHANGED
File without changes
body CHANGED
@@ -183,4 +183,8 @@
183
183
  return state;
184
184
  }
185
185
  }
186
- ```
186
+ ```
187
+
188
+ ###試したこと
189
+ [https://github.com/supasate/connected-react-router/issues/260](https://github.com/supasate/connected-react-router/issues/260)
190
+ 上記のサイトにバージョンを6.0.0にダウングレードさせるように記述されていましたが、試してみても変わりませんでした。