Hi
I'm learning ngrx store and I'm new.
I know that Reducers are like Action Listeners. Then I learned that Effects can also handle Actions. I'm a bit lost here. Isnt the case that Reducers are the only ones who can handle Actions and change State?
Thanks
Reducers use actions to change state. Effects are used to listen for actions and return new actions
Hi @brandonroberts what if both Reducers and Effects listen to the same Action. Who runs first? So as an example an Effect might listen to an Action to load data from server. This action doesn't change State so no need to listen 5o it by a reducer. Effects listen to the action and loads data from server and then fires an event with a payload of data received and raises an event for the reducer to catch and update state accordingly? That's how it works?
Thanks
Yes. More specifically all actions hit all reducers first, then the action is passed to the effects.
Thanks a lot @brandonroberts !
Most helpful comment
Yes. More specifically all actions hit all reducers first, then the action is passed to the effects.