在 Redux 中,使用中间件增强存储会出现 'unexpected keys' 错误
In Redux, using middlewares to enhance store gives 'unexpected keys' error
我收到这个错误:
Unexpected keys "dispatch", "subscribe", "getState", "replaceReducer",
"liftedStore" found in preloadedState argument passed to createStore.
Expected to find one of the known reducer keys instead: "form".
Unexpected keys will be ignored.
我的新 redux 商店,应用了中间件是:
// redux extension
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION__ || compose;
const enhancer = composeEnhancer(applyMiddleware(promiseMiddleware()));
const store = createStore(reducer, enhancer);
我遵循了这里的指南:
https://github.com/zalmoxisus/redux-devtools-extension
将 __REDUX_DEVTOOLS_EXTENSION__
替换为 __REDUX_DEVTOOLS_EXTENSION_COMPOSE__
。前者是一个完整的增强器,如果您不使用任何中间件或增强器,您可以直接将其传递给 createStore
。后者就是你要找的组合函数
我收到这个错误:
Unexpected keys "dispatch", "subscribe", "getState", "replaceReducer", "liftedStore" found in preloadedState argument passed to createStore. Expected to find one of the known reducer keys instead: "form". Unexpected keys will be ignored.
我的新 redux 商店,应用了中间件是:
// redux extension
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION__ || compose;
const enhancer = composeEnhancer(applyMiddleware(promiseMiddleware()));
const store = createStore(reducer, enhancer);
我遵循了这里的指南: https://github.com/zalmoxisus/redux-devtools-extension
将 __REDUX_DEVTOOLS_EXTENSION__
替换为 __REDUX_DEVTOOLS_EXTENSION_COMPOSE__
。前者是一个完整的增强器,如果您不使用任何中间件或增强器,您可以直接将其传递给 createStore
。后者就是你要找的组合函数