We don't recommend removing redux-saga
, as we strongly feel that it's the
way to go for most redux based applications.
If you really want to get rid of it, you will have to delete its traces from several places.
app/configureStore.js
- Remove statement
import createSagaMiddleware from 'redux-saga'
. - Remove statement
const sagaMiddleware = createSagaMiddleware()
. - Remove
sagaMiddleware
frommiddlewares
array. - Remove statement
store.runSaga = sagaMiddleware.run
- Remove
store.injectedSagas = {}; // Saga registry
app/utils
- Remove two files:
injectSaga.js
andsagaInjectors.js
.
app/containers/*/index.js
Clean up containers that inject a dynamic saga
- Remove saga injections like:
const withSaga = injectSaga({ key: 'home', saga });
.
Finally, remove it from the package.json
. Then you should be good to go with whatever
side-effect management library you want to use!
To remove reselect
, remove it from your dependencies in package.json
and then write
your mapStateToProps
functions like you normally would!
You'll also need to hook up the history directly to the store. Make changes to app/app.js
.
- Remove statement
import { makeSelectLocationState } from 'containers/App/selectors'
- Make necessary changes to
history
as follows:
const makeSelectLocationState = () => {
let prevRoutingState;
let prevRoutingStateJS;
return (state) => {
const routingState = state.get('route'); // or state.route
if (!routingState.equals(prevRoutingState)) {
prevRoutingState = routingState;
prevRoutingStateJS = routingState.toJS();
}
return prevRoutingStateJS;
};
};
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState: makeSelectLocationState(),
});