Advanced Redux — Side Effects, Async Tasks & ThunksEntry 9 of 9

Summary

ConceptRedux ToolkitNgRx
Reducer rulePure, sync, no side effectsPure, sync, no side effects
Side effect locationComponent useEffect or thunkEffect + service
ThunkFunction dispatched instead of an action; gets dispatch, getState— (Effects fill this role)
MiddlewareThunk, built into configureStoreprovideEffects()
Standard async helpercreateAsyncThunk + extraReducerscreateActionGroup + createEffect + on()
Read state in async codegetState()concatLatestFrom()
Avoid saving initial datachanged flagTrigger on user actions only
Global status messagesui slice + showNotificationui feature + showNotification
HTTP codeThunk or api.tsService

Reducers stay pure in both ecosystems, so async work moves elsewhere: thunks in Redux Toolkit, Effects in NgRx. createAsyncThunk and NgRx Effects solve the same problem. RTK is pulled by the component dispatching a function; NgRx is pushed by actions flowing through an RxJS stream, with HTTP always isolated in a service.