This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

redux-root-reducer

0.0.6 • Public • Published

Redux root-reducer

Allows you to combine multiple reducers into one for state management.
Divide your reducer into smaller ones for easier code maintenance.

Installation

npm install redux-root-reducer
#or
yarn add redux-root-reducer

Example

folder structure

  reducers/
    testReducer.js
    testReducer2.js
  store.js
  rootReducer.js

rootReducer.js

import createRootReducer from 'redux-root-reducer';
import reducer from './reducers/testReducer.js';
import reducer2 from './reducers/testReducer.js';

const rootReducer = createRootReducer(
  reducer,
  reducer2
);
export default rootReducer

reducers/testRedducer.js

// you can get and modify redux-state from within this function
export default function testReducer(state, action){ 
  switch (action.type){

    case 'ACTION_TYPE' : {
      // your code
      return {
        // return your new state
      }
    };
    case 'ACTION_TYPE2' : {
      // your code
    }

    // make sure to add a default section which return false
    default : return false
  }
}

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i redux-root-reducer

    Weekly Downloads

    1

    Version

    0.0.6

    License

    ISC

    Unpacked Size

    2.11 kB

    Total Files

    3

    Last publish

    Collaborators

    • ravshan01