redux-sagas-injector-forked
Forked package which used reducers forked package.
redux-sagas-injector
Helper for loading sagas asynchronously using redux with redux-injector
Adding a new saga is then done with injectSaga at any time. You can also make them hot replacement module compatible thanks to the reloadSaga helper. 🎉
Installation
Install redux-sagas-injector
via npm.
npm install --save redux-sagas-injector
Then with a module bundler like webpack that supports either CommonJS or ES2015 modules, use as you would anything else:
// using an ES6 transpiler, like babel; // not using an ES6 transpilervar createInjectSagasStore = createInjectSagasStore;
createInjectSagasStore
instead of createStore
or createInjectStore
Use You also need to use the sagaMiddleware
from the lib. It is basically a createSagaMiddleware()
from 'redux-saga'.
;; const enhancers = ; const store = ; // Hot reload sagas (requires Webpack or Browserify HMR to be enabled)if modulehot modulehotaccept'./sagas' { ; };
## Injecting a new saga.
For any store created using redux-sagas-injector, simply use injectSaga
to add a new saga.
; ;
Be careful when injecting a saga, every time you'll use it, it will add a new saga. A Saga is defined by a key (string) and a array of strings is persisted in the store. You cannot erase it or delete it. Reinjecting a saga with the same key will do nothing.
You should use injectSaga in complement with injectReducer for loading your js code asynchronously via routing.
Example:
;; path: 'item(/:id)' { require; };