我正在尝试按照此处的说明设置 redux-polyglot:https ://www.npmjs.com/package/redux-polyglot
我的问题是,当我添加该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;