Thursday, February 15, 2018

the difference between actions and effects in the Redux paradigm

An action puts something in the store or affects state in some way, changes state. An effect has nothing to do with the store. An API call would be an example of an effect.

 
 

Addendum 1/3/2018: You can hand an action into an effect as an object however so that the effect has the same data as an action. It can fish out what it needs.

 
 

Addendum 11/27/2018: ngrx/effects are for side effects at the ngrx/store Redux orchestrations. This (in contrast and conflict to the definition of effects given above) suggests that there are effects or more specifically side effects, if you will, that may happen as "middleware" midstream into the write-back-to-the-store process that may be of the store. A side effect may just call out to an API endpoint as sort of suggested above or that they may kick off other actions breaking with what is above as that scenario has to do with the store itself.

No comments:

Post a Comment