react-fluxify
Version:
Fluxify is a powerful and user-friendly npm package that simplifies the management of application state with React and Redux. It provides intuitive methods and pre-configured components for seamless integration, reducing boilerplate code and enhancing the
24 lines • 962 B
JavaScript
import createSagaMiddleware from "redux-saga";
import { persistReducer, persistStore } from "redux-persist";
import { configureStore } from "@reduxjs/toolkit";
import storage from "redux-persist/lib/storage";
var reduxifyStore = function (_a) {
var persistKey = _a.persistKey, reducers = _a.reducers, sagas = _a.sagas;
var persistConfig = {
key: persistKey,
storage: storage,
};
var persistedReducer = persistReducer(persistConfig, reducers);
var sagaMiddleware = createSagaMiddleware();
var store = configureStore({
reducer: persistedReducer,
middleware: function (getDefaultMiddleware) {
return getDefaultMiddleware().concat(sagaMiddleware);
},
});
var persistor = persistStore(store);
sagas.forEach(function (saga) { return sagaMiddleware.run(saga); });
return { store: store, persistor: persistor };
};
export default reduxifyStore;
//# sourceMappingURL=index.js.map