Skip to content

Instantly share code, notes, and snippets.


malihassan20/store.js Secret

Created Jan 17, 2018
What would you like to do?
import { createStore, applyMiddleware } from 'redux';
import withRedux from 'next-redux-wrapper';
import nextReduxSaga from 'next-redux-saga';
import createSagaMiddleware from 'redux-saga';
import rootReducer, { initialState } from './reducer';
import rootSagas from './saga';
const sagaMiddleware = createSagaMiddleware();
export function configureStore(state = initialState) {
const store = createStore(rootReducer, state, applyMiddleware(sagaMiddleware));
store.sagaTask =;
return store;
export function withReduxSaga(BaseComponent) {
return withRedux(configureStore)(nextReduxSaga(BaseComponent));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment