2016-04-30 16 views
1

現在、私のreduxセットアップ(Immutable.jsをその状態で使用しています)は、必要に応じて完全に機能します。Redux Dev Tools Chrome拡張機能Immutable.jsでエラーが発生しました

コンテキストの場合

An error occurred in the reducer TypeError: n.withMutations is not a function

、私は、よく、私の反応 - ルータ - Reduxの減速を組み合わせて、その組み合わせ減速のためのredux-immutable機能使用しています::しかし、Reduxの開発ツールの拡張機能が開かれるたびに次のエラーが出力さ

import { fromJS } from 'immutable'; 
import { LOCATION_CHANGE } from 'react-router-redux'; 

const initialState = fromJS({ 
    locationBeforeTransitions: null, 
}); 

export default (state = initialState, action) => { 
    if (action.type === LOCATION_CHANGE) { 
    return state.merge({ 
     locationBeforeTransitions: action.payload, 
    }); 
    } 
    return state; 
}; 

と私のビジネスロジックレデューサー。

更新:ウェブパックを使用してプロダクションバンドルをビルドし、プロダクションモード(ドッキング用のコンテナ内)でアプリケーションをテストし、開発モード(ローカルマシンのドッカーなし)でアプリを再度テストすると、問題?奇数...

+1

この問題は、以下の回答で解決されていますか?十分な場合は、状況を更新したり、回答を受け入れることができますか? – anoop

答えて

1

あなたがreact-router-reduxを使用したい場合は、あなた自身の減速を実装する必要はありません、 だけで以下のようにreact-router-reduxからキールーティングなどrouterReducer(重要)をインポートし、他の減速と結合し、

import { syncHistoryWithStore, routerReducer } from 'react-router-redux' 
// Add the reducer to your store on the `routing` key 
const store = createStore(
    combineReducers({ 
    ...reducers, 
    routing: routerReducer 
    }) 
) 

//To Sync navigation events with the store 
const history = syncHistoryWithStore(browserHistory, store) 

ReactDOM.render(
    <Provider store={store}> 
    { /* Tell the Router to use our enhanced history */ } 
    <Router history={history}> 
     <Route path="/" component={App}> 
     <Route path="foo" component={Foo}/> 
     <Route path="bar" component={Bar}/> 
     </Route> 
    </Router> 
    </Provider>, 
    document.getElementById('mount') 
) 

これはあなたが実装しようとしているものです

関連する問題