@redux-eggs/redux-toolkit
TypeScript icon, indicating that this package has built-in type declarations

3.0.0-alpha.4 • Public • Published

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()])

Readme

Keywords

none

Package Sidebar

Install

npm i @redux-eggs/redux-toolkit

Weekly Downloads

1,981

Version

3.0.0-alpha.4

License

MIT

Unpacked Size

9.02 kB

Total Files

6

Last publish

Collaborators

  • fostyfost