@redux-eggs/redux
v3.0.0-alpha.4
Published
_Redux Eggs_ wrapper for [Redux](https://redux.js.org/).
Downloads
384
Readme
Redux Eggs for Redux
Redux Eggs wrapper for Redux.
Contents:
Installation:
If you are using Yarn, run
yarn add @redux-eggs/core @redux-eggs/redux
If you are using NPM, run
npm install --save @redux-eggs/core @redux-eggs/redux
⚠️ Minimum supported versions of peer dependencies:
redux
4.0.0 and newer
Usage
Create your store:
import { createStore } from '@redux-eggs/redux'
export const store = createStore()
Add reducer to egg
:
// my-egg.js
import { myReducer } from '../my-reducer'
export const getMyEgg = () => {
return {
id: 'my-egg',
reducersMap: {
myState: myReducer,
// ...
},
// ...
}
}
// my-another-egg.js
import { myAnotherReducer } from '../my-another-reducer'
export const getMyAnotherEgg = () => {
return {
id: 'my-another-egg',
reducersMap: {
myAnotherState: myAnotherReducer,
// ...
},
// ...
}
}
Add egg
to your store:
import { getMyEgg } from '../eggs/my-egg'
// Somewhere in your application
store.addEggs([getMyEgg()])
// Somewhere else
import { getMyAnotherEgg } from '../eggs/my-another-egg'
// Somewhere in your application
store.addEggs([getMyAnotherEgg()])