Redux basic flow - Hemantsaraf08/reduxintrowithnotes GitHub Wiki

flow diagram

image

Terminology

Store

An obj having the state of the application (global store) [although each Comp. can have their local store]

Action

Our component can't directly change the state of our store, it does this by dispatching an Action obj, which are present in Action creator function Action is an obj. with two prp. TYPE and PAYLOAD (payload being optional)

Dispatch

It is present with component, it helps ACTION REACH REDUCER

Reducer

These are pure functions, i.e. don't pollute their scope (no async tasks) and do changes immutably. They consume ACTIONS and based on TYPE of action they make changes in store. They take 2 arguments 1. part of store (thats why we combine reducer) 2. relevant actions

The components which receive States (as props ) from Central Store make an Automatic Subscription to the store. Therefore if the value stored in the state changes. Components which are subscribed to it get automatically re-rendered