combine-reducers-hook

1.0.3 • Public • Published

CombineReducers for using 'useReducer' of react hook

Install

Install with npm:

$ npm install --save combine-reducers-hook

Usage

store/reducers.js

export default{
   testName(state='ttt',action){
      const {type,payload} = action;
      switch(type){
        case SET_NAME:
          return payload;
        default:
      } 
      return state
   }
}


store/index.js

import React,{useReducer,createContext} from 'react';
import combineReducers from 'combine-reducers-hook';
import reducers from './reducers';

let [state,dispatch] = useReducer(combineReducers(reducers),initState);

See the examples folder for usage examples.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i combine-reducers-hook

      Weekly Downloads

      1

      Version

      1.0.3

      License

      MIT

      Unpacked Size

      2.37 kB

      Total Files

      4

      Last publish

      Collaborators

      • totanwenbin