import {createStore,applyMiddleware,compose} from 'redux';
import createSagaMiddleware from 'redux-saga';
const sagaMiddleware = createSagaMiddleware();
const middlewares = [];
let storeEnhancers = compose(
applyMiddleware(...middlewares,sagaMiddleware),
(window && window .devToolsExtension) ? window .devToolsExtension() : (f) => f,
);
const store = createStore(rootReducer, initialState={} ,storeEnhancers);
我的测试代码
import {combineReducers,createStore,applyMiddleware,compose} from "redux";
import {User} from "./redux/user.redux";
import thunk from 'redux-thunk';
//用于chrome redux的扩展项
const reduxExtension=window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__();
let reducer=combineReducers({User});
let store=createStore(reducer,compose(applyMiddleware(thunk),reduxExtension));
export default store;
网友评论