_Redux Eggs_ wrapper for [Redux](https://redux.js.org/).
npm install @redux-eggs/redux_Redux Eggs_ wrapper for Redux.
Contents:
- Installation
- Usage
- Glossary
- Examples
If you are using Yarn, run
``shell`
yarn add @redux-eggs/core @redux-eggs/redux
If you are using NPM, run
`shell`
npm install --save @redux-eggs/core @redux-eggs/redux
⚠️ Minimum supported versions of peer dependencies:
- redux 4.0.0 and newer
Create your store:
`typescript
import { createStore } from '@redux-eggs/redux'
export const store = createStore()
`
Add reducer to egg:
`typescript
// 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:
`typescript
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()])
``