Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with reactotron #8

Closed
dragonfire1119 opened this issue Feb 6, 2018 · 3 comments
Closed

Not compatible with reactotron #8

dragonfire1119 opened this issue Feb 6, 2018 · 3 comments

Comments

@dragonfire1119
Copy link
Contributor

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

@anish000kumar
Copy link
Owner

anish000kumar commented Feb 6, 2018

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;

@dragonfire1119
Copy link
Contributor Author

@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.

@anish000kumar
Copy link
Owner

@dragonfire1119 Reactron seems to be extensible. I guess you can create an issue for compatibility with Redux box there as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants