Utility function to create reducers
a reducer function
import { createEvent, createReducer } from 'reactive-actor';export interface LayoutState { loading: boolean; error: string;}export const layoutInitialState: LayoutState = { loading: false, error: '',};export const startLoader = createEvent('START_LOADER');export const stopLoader = createEvent('STOP_LOADER');export const layoutReducer = createReducer(layoutInitialState, (builder) => builder .addCase(startLoader, (state) => ({ ...state, loading: true })) .addCase(stopLoader, (state) => ({ ...state, loading: false })));
reducer initial state
a function that takes an instance of ReducerBuilder<S> as parameter to generate the reducer
ReducerBuilder<S>
Generated using TypeDoc
Utility function to create reducers
Returns
a reducer function
Example