your recipe card header background

    NgRx Create Reducer

    0

    0

    lucycodes42

    Angular snippets for TypeScript

    This code is creating a reducer function. The reducer function takes two arguments, state and action. state is the current state of the reducer, and action is the action that was dispatched. The reducer function then returns a new reducer, which will take the current state and the action as input and return a new state.

    Library: angular

    Shortcut: a_ngrx_create_reducer

    const featureReducer = createReducer(
      initialState,
      on(Actions.action, state => ({ ...state, prop: updatedValue })),
    );
    
    export function reducer(state: State | undefined, action: Action) {
      return Reducer(state, action);
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.