New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

redux-root-reducer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-root-reducer

create-redux-root-reducer

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

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
  }
}

Keywords

redux

FAQs

Package last updated on 06 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts