UNPKG

reactotron-redux

Version:
19 lines (18 loc) 679 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_REPLACER_TYPE = void 0; exports.default = reactotronReducer; const DEFAULT_REPLACER_TYPE = exports.DEFAULT_REPLACER_TYPE = "REACTOTRON_RESTORE_STATE"; function reactotronReducer( // eslint-disable-next-line @typescript-eslint/ban-types rootReducer, actionName = DEFAULT_REPLACER_TYPE) { // return this reducer return (state, action) => { // is this action the one we're waiting for? if so, use the state it passed const whichState = action.type === actionName ? action.state : state; return rootReducer(whichState, action); }; } //# sourceMappingURL=reducer.js.map