@redux-eggs/redux-toolkit
v3.0.0-alpha.4
Published
_Redux Eggs_ wrapper for [Redux Toolkit](https://redux-toolkit.js.org/).
Downloads
7,714
Readme
Redux Eggs for Redux Toolkit
Redux Eggs wrapper for Redux Toolkit.
Contents:
Installation:
If you are using Yarn, run
yarn add @redux-eggs/core @redux-eggs/redux-toolkit
If you are using NPM, run
npm install --save @redux-eggs/core @redux-eggs/redux-toolkit
⚠️ Minimum supported versions of peer dependencies:
@reduxjs/toolkit
1.6.0 and newer
Usage
Create your store:
import { createStore } from '@redux-eggs/redux-toolkit'
export const store = createStore()
Add reducer from slice to egg
:
// my-egg.js
import { mySlice } from '../my-slice'
export const getMyEgg = () => {
return {
id: 'my-egg',
reducersMap: {
myState: mySlice.reducer,
// ...
},
// ...
}
}
// my-another-egg.js
import { myAnotherSlice } from '../my-another-slice'
export const getMyAnotherEgg = () => {
return {
id: 'my-another-egg',
reducersMap: {
myAnotherState: myAnotherSlice.reducer,
// ...
},
// ...
}
}
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()])