Actions and Reducers

At first Redux looks very complex even when its API is very small. There are a few simple rules that you have to know to use Redux successfully:

  1. States are saved in a single object called a store.
  2. Only a reducer function can update state changes in a Redux store
  3. A reducer function is triggered by an action.
  4. Actions is dispatched (called) from within your application.

Another way of looking at it

  1. The application is the customer
  2. An action is a service request to a service supplier (reducer) with a request for change (what kind of change + explanatory data)
  3. The service supplier (reducer) sends the request action based on the kind of request to the service department (function)
  4. The service department uses the explanatory data (data) and makes a copy of the current situation and scribbles the modifications to it.
  5. From now on the new situation is the current situation...until the next service request action passes by.

A cartoon intro to Redux

Last update: Tue, 13 Sep 2022 14:32:15