Monday, December 3, 2018

the @Effect decorator and the trailing dollar sign naming convention

The side effect model for the @ngrx way to go for Redux can be found here. You are going to use the @Effect decorator with this stuff like so:

@Effect() handleFailure$: Observable<any>;

 
 

...and like so:

@Effect({dispatch:false}) handleFailure$: Observable<any>;

 
 

You need the {dispatch:false} when you have an effect that does not kick off another action. Also note that the trailing dollar sign naming convention denotes that a variable is an Observable. In jQuery a leading dollar sign at a variable name denotes a DOM element by convention, but in this case we have rhyming names for all of the Observables in lieu of alliteration.

No comments:

Post a Comment