forked from RoadRunner-Team/Frontend-store
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (19 loc) · 680 Bytes
/
Copy pathindex.js
File metadata and controls
22 lines (19 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import "regenerator-runtime/runtime";
import { createStore, applyMiddleware, compose } from "redux";
import createSagaMiddleware from "redux-saga";
import rootReducer from "./rootReducer";
import rootSaga from "./rootSaga";
// ===== middleware 추가
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware];
// ===== store 생성
export const configureStore = (state = {}) => {
const composeEnhancers =
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; // redux-devtools-extension
const store = createStore(
rootReducer,
composeEnhancers(applyMiddleware(...middlewares))
);
sagaMiddleware.run(rootSaga);
return store;
};