react-reducer-store
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -69,3 +69,16 @@ 'use strict'; | ||
function combineReducers(reducers) { | ||
return function (state, action) { | ||
var newState = {}; | ||
Object.keys(reducers).forEach(function (r) { | ||
var reducerState = state[r]; | ||
reducerState = reducers[r](reducerState, action); | ||
newState[r] = reducerState; | ||
}); | ||
return newState; | ||
}; | ||
} | ||
exports.Store = Store; | ||
exports.useStore = useStore; | ||
exports.combineReducers = combineReducers; |
@@ -62,2 +62,14 @@ import React, { createContext, useReducer, useContext } from 'react'; | ||
export { Store, useStore }; | ||
function combineReducers(reducers) { | ||
return function (state, action) { | ||
var newState = {}; | ||
Object.keys(reducers).forEach(function (r) { | ||
var reducerState = state[r]; | ||
reducerState = reducers[r](reducerState, action); | ||
newState[r] = reducerState; | ||
}); | ||
return newState; | ||
}; | ||
} | ||
export { Store, useStore, combineReducers }; |
{ | ||
"name": "react-reducer-store", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"main": "dist/index.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.esm.js", |
39612
126