3.0.0-alpha.4 • Published 3 years ago
@redux-eggs/saga-extension v3.0.0-alpha.4
Redux Eggs Saga Extension
Redux Eggs extension that brings dynamic sagas to your Redux store.
Contents:
Installation:
If you are using Yarn, run
yarn add @redux-eggs/core @redux-eggs/saga-extensionIf you are using NPM, run
npm install --save @redux-eggs/core @redux-eggs/saga-extension⚠️ Minimum supported versions of peer dependencies:
redux-saga1.1.0 and newer
Usage
Create your store:
import { createStore } from '@redux-eggs/redux-toolkit'
import { getSagaExtension } from '@redux-eggs/saga-extension'
export const store = createStore({ extensions: [getSagaExtension()] })Add sagas to your eggs:
// my-egg-with-sagas.js
export const getMyEggWithSagas = () => {
return {
id: 'my-egg-with-sagas',
sagas: [mySaga1, mySaga2],
// ...
}
}
// my-another-egg-with-sagas.js
export const getMyAnotherEggWithSagas = () => {
return {
id: 'my-another-egg-with-sagas',
sagas: [mySaga3, mySaga4],
// ...
}
}Your sagas will run automatically, just add them to your store:
import { getMyEggWithSagas } from '../eggs//my-egg-with-sagas'
import { getMyAnotherEggWithSagas } from '../eggs/my-another-egg-with-sagas'
// Somewhere in your application
store.addEggs([getMyEggWithSagas(), getMyAnotherEggWithSagas()])Remove your sagas from store, they will be cancelled automatically:
// Somewhere in your application
const remove = store.addEggs([
/* array of `eggs` */
])
// ...later
remove()3.0.0-alpha.3
3 years ago
3.0.0-alpha.4
3 years ago
2.2.0
4 years ago
2.1.0
4 years ago
2.0.0
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago