2016-10-28 2 views
1

私はReact Reduxアプリを持っていて、私のレデューサーの1人でreact-routerの位置変更を待ち受けようとしています。私はhashHistoryを使用していますが、browserHistoryではありません。私の再来のデベロッパーツールでは、私は場所が変更されたとき、それがアクションを発射されて見ることができます:私は「LOCATION_CHANGE」の聴くとredux reducerの反応ルータ位置の変更をどのように聞きますか?

enter image description here

しかし、私の減速で、それが何かをキャッチしません。

import * as types from '../constants/actionTypes'; 
import objectAssign from 'object-assign'; 
import initialState from './initialState'; 

export default function listingsReducer(state = initialState.listings, action) { 
    switch (action.type) { 
    case 'LOCATION_CHANGE': { 
     console.log(action); //currently doesn't get into this case block 
     return state; 
    } 
    default: 
     return state; 
    } 
} 

私のレデューサーでこの行動を処理するには何が必要ですか?

答えて

6

変更case 'LOCATION_CHANGE'~case '@@router/LOCATION_CHANGE'

関連する問題