1.0.3 • Published 4 years ago

combine-reducers-hook v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

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.

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago