redux-tiles
Version:
Library to create and easily compose redux pieces together in less verbose manner
27 lines (26 loc) • 1.33 kB
TypeScript
import { Reducer } from 'redux';
import { ReducerObject } from './types';
/**
* @overview create reducer function from the object
* @param {Any} initialState – initial state of this part of the store
* @param {Object} handlers – object with keys as action types, and
* reduce functions to change store as values
* @return {Function} – function to act as a reducer
*/
export declare function createReducerFromObject(initialState: any, handlers: ReducerObject): Reducer<any>;
/**
* @overview create reducer from the object, with creating reducing functions
* @param {Any} initialState – initial state of this part of the store
* @param {Object} handlers – object with keys as action types, and
* newValues to set at store as values
* @return {Function} – function to act as a reducer
*/
export declare function createReducer(initialState: any, handlers: ReducerObject): Reducer<any>;
/**
* @overview reducer function, which changes the state with new values
* @param {Object} action – reducer action object, with type and payload
* @param {Object} state – previous redux state in this branch
* @param {Any} newValue – new value to set up in state in corresponding path
* @return {Object} – changed reducer
*/
export declare function reducerCreator({action, state, newValue}: any): any;