与Chrome上的redux devtools有关的事情导致我的Web应用程序崩溃。
我从浏览器中清除了所有数据,如果禁用了redux devtools,则可以正常工作。
以下代码块显示了抛出的异常:
错误:在reducer处于运行状态时,您不能调用store.getState() 执行。减速器已经接收到该状态作为参数。 从顶部减速器传递而不是从商店中读取
这是我的商店配置(直到今天早上正常工作):
import { createStore, combineReducers, compose, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { auth, commmon, posts } from './reducers';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
import { rootSaga } from './sagas';
let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const sagaMiddleware = createSagaMiddleware();
const rootReducer = combineReducers({
common: commmon,
auth: auth,
posts
});
const configureStore = () => {
const store = createStore(
rootReducer,
composeEnhancers(
applyMiddleware(thunk),
applyMiddleware(sagaMiddleware),
applyMiddleware(logger)
)
);
sagaMiddleware.run(rootSaga);
return store;
};
export default configureStore;