2017-07-06 2 views
0

が定義されていません:https://www.npmjs.com/package/redux-polyglot「createPolyglotMiddlewareは」私はここの指示に従ってReduxの-ポリグロットを設定しようとしている

私の問題は、私はconst polyglotMiddleware = createPolyglotMiddleware(一部を追加するとき、私はそれが定義されていない私に言ってエラーが出るということです。私はどこに間違っているのか分からない。誰も助けることができますか?ここで

は私のリデューサーコードです:

import { createStore, combineReducers, applyMiddleware } from 'redux'; 
import { polyglotReducer } from 'redux-polyglot'; 

const rootReducer = combineReducers({ 
    polyglot: polyglotReducer 
}); 


const polyglotMiddleware = createPolyglotMiddleware(
    'ACTION_TO_CATCH', 
    action => action.payload.locale, 
    locale => new Promise(resolve => { 
     // perform async here 
     resolve({ 
      hello: 'bonjour', 
     }); 
    }), 
) 

const store = createStore(rootReducer, {}, applyMiddleware(polyglotMiddleware)); 

export default store; 

答えて

1

私はあなたがあなたのトップモジュールに次のことを試して、createPolyglotMiddlewareをインポートするのを忘れていると思う:

import { polyglotReducer, createPolyglotMiddleware } from 'redux-polyglot'; 
+0

はい、あなたは正しいです。明らかに指摘されたときにはっきり言っても、私は彼らの文書にそれがないと思っています。 –

関連する問題