Closed dragonfire1119 closed 6 years ago
In cases where you need use to {createStore} from 'redux'
, you can always register your modules with redux store manually:
(v1.3.9 onwards)
import {applyMiddleware,combineReducers, compose, createStore} from 'redux';
import createSagaMiddleware from "redux-saga";
import {all} from 'redux-saga/effects';
import {moduleToReducer} from 'redux-box'
import {module as homeModule} from './home'
import {module as userModule} from './user'
//hook up your module reducers
const combinedReducer = combineReducers({
home : moduleToReducer(homeModule),
user : moduleToReducer(userModule)
})
// hook up your module sagas
const sagas = [
...homeModule.sagas,
...userModule.sagas
]
// hook up your middlewares here
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware];
//what follows below is the usual approach of setting up store
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
let enhancer = composeEnhancers(applyMiddleware(...middlewares))
function *rootSaga(){
yield all(sagas)
}
const store = createStore( combinedReducer, enhancer );
sagaMiddleware.run(rootSaga);
export default store;
@anish000kumar Thanks for the reply! Ok I figured it would probably be more boilerplate code to hookup reactorton. Guess Ill have to weigh the advantage to that much added code against the clean code that redux-box has already.
@dragonfire1119 Reactron seems to be extensible. I guess you can create an issue for compatibility with Redux box there as well.
Reactotron uses it's own createStore which is not compatible with redux-box createStore. You can see a break down of how reactotron works here https://github.com/infinitered/reactotron/blob/master/docs/plugin-redux.md
Also the redux-saga reactotron plugin is not compatible either it doesn't seem like. https://github.com/infinitered/reactotron/blob/master/docs/plugin-redux-saga.md