Skip to content

Instantly share code, notes, and snippets.

@Ledoux
Created April 16, 2019 21:03
Show Gist options
  • Save Ledoux/73fe9d82357fe7883dbe2c298f29e810 to your computer and use it in GitHub Desktop.
Save Ledoux/73fe9d82357fe7883dbe2c298f29e810 to your computer and use it in GitHub Desktop.
import { applyMiddleware, combineReducers, createStore } from "redux";
import createSagaMiddleware from "redux-saga";
import { all } from "redux-saga/effects";
import { createDataReducer, watchDataActions } from "redux-saga-data";
const sagaMiddleware = createSagaMiddleware();
const storeEnhancer = applyMiddleware(sagaMiddleware);
function* rootSaga() {
yield all([
watchDataActions({
fetchData
})
]);
}
const rootReducer = combineReducers({ data: createDataReducer({}) });
const store = createStore(rootReducer, storeEnhancer);
sagaMiddleware.run(rootSaga);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment