Questions tagged ngrx-reducers

Explore the latest questions and answers asked by our top developers.

Angular is giving State’ is not assignable to type ‘ActionReducer<State, Action>’ error

Above error is thrown by VSCode IDE, while trying to combine reducers in one file. import { ActionReducerMap } from ‘@ngrx/store’; import { employeeReducer, State } from ‘./store/reducers/employee.reducer’; export interface AppState { employee: State; } export const appReducer: ActionReducerMap<AppState> = { employee: employeeReducer, // Getting IDE error here }; My action looks like import { […]

By Rajath
Published
Categorized as angular, angular13, ngrx-reducers, ngrx-store Tagged , , ,

How to update state with an array via NGRX reducer in Angular?

I want to update my state using a ngrx reducer but I’m getting an compilation error. For context. The user submits a worklog on a form, and I want this worklog to be added to the worklogs array on the state. Here is the structure of my state: export declare interface Outreach { outreach: CaseState|null; […]

Registering reducer in app.module shows error in angular ngrx state management

I am creating an application in Angular 12 and the latest NgRx library for turorial purposes. I have the below model, action, reducer, and app state class. Model export interface Tutorial { name: string; url: string; } Actions import { Injectable } from ‘@angular/core’ import { Action } from ‘@ngrx/store’ import { Tutorial } from […]

By mnu-nasir
Published
Categorized as angular, ngrx, ngrx-reducers Tagged , ,

Uncaught TypeError: Object(…) is not a function when using ngrx reducer ? Angular

I am follow this tutorial: https://www.youtube.com/watch?v=HN96QmxBRgI&list=PL_euSNU_eLbdg0gKbR8zmVJb4xLgHR7BX&index=18 And write same as teacher but i got error in console: Uncaught TypeError: Object(…) is not a function at Module../src/app/posts/state/posts.reducer.ts What happen here ? Why ? I am check version angular and version ngrx store and downgrade on same version like men in youtube tutorial but i got error […]

By yanadod
Published
Categorized as angular, ngrx, ngrx-reducers, redux Tagged , , ,

ngRx Store – Reducer returns undefined – store.select() is undefined

it’s my first time working with ngRx Store and I implemented my first effect.. What is working fine: communication with backend actions are being executed in backend (delete, add, get) payload is getting to the reducer from effects (logged it to be sure) So my problem is that I can not get Data from my […]

Getting error ‘Types of parameters ‘action’ and ‘action’ are incompatible’ when trying to add reducer to the ngrx store in app.module

I have been trying to create a sample TODO application to learn ngrx, my application has ‘Actions’ like ADD_TASK, REMOVE_TASK, UPDATE_TASK and LIST_TASk and it has a reducer function which does operations on the state based on the action types. Please, find below my apps actions and reducers code. tasksactions.ts import { Action } from […]

NgRx – reducer is being triggered for infinite times

I am trying to retrieve local storage data via NgRx effect. PATIENT_FETCH action is dispatched to execute an effect. But having an infinite call upon calling the dispatch method in ngOnInit method. Here is the stackblitz demo. If you uncomment line 24 in patient.component.ts of given link then reducer is called for infinite times. I […]

Ngrx-store dispatch action if the reducer modify the state

I use ngrx in my angular application. There is a way to dispatch an action inside the reducer after the state was modify? Normally is an anti-pattern, so I am looking for a correct way to achieve this objective. I am looking for something like this: on(Actions.someAction, (state, action) => { if(checkFail) { return state; […]

By LucaFongaro
Published
Categorized as angular, ngrx, ngrx-reducers, ngrx-store Tagged , , ,

Chaining high order reducers

Problem I’d like to chain multiple high order reducers using ngrx, so that similar parts of code in my reducers have only one implementation. My application has number of pages that have quite similar functionalities. Their reducers also look quite similar. For this example let’s consider an application with three pages: Page One, Page Two […]

Reusing reducers logic

Problem I’d like to chain multiple high order reducers using ngrx, so that similar parts of code in my reducers have only one implementation. My application has number of pages that have quite similar functionalities. Their reducers also look quite similar. For this example let’s consider an application with three pages: Page One, Page Two […]

1 2

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq