Skip to main content


Showing posts from October 7, 2021

Angular NgRx: A Simple Effect

Greetings! In this fourth installment of our simple NgRx example series we are going to have a look at effects. Yet again, our example will be very simple. This is the complete example What we need Store with initial state Create action to add, remove http status codes Create reducers act upon actions Create selector to read from store Create an effect to store http status url Register the reducer Register the effect Generate the Project ng new ngrx-hello-effects --routing=false --style=css cd ngrx-hello-effects/ ng add @ngrx/store@latest ng add @ngrx/effects@latest ng serve Create the Store At this point i'll asume that you have atleast little idea about the action, reducer and selectors. Hence i'll just add the code. One change i'm doing here to previous examples is I have created separate files. ngrx-hello-effects/src/app/store/app.state.ts export interface HttpCodeState