rt
@redux-eggs/redux-toolkit
npm i @redux-eggs/redux-toolkit
rt

@redux-eggs/redux-toolkit

Add some Eggs to your Redux store.

by Fosty Fost

2.2.0 (see all)License:MITTypeScript:Built-In
npm i @redux-eggs/redux-toolkit
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()])
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate