DEV Community

Discussion on: Explain Redux Like I'm Five

Collapse
 
zeddotes profile image
zeddotes
  • Your entire app relies on 1 data object, called the store.
  • There are 2 main functions on the store: read actions and mutate itself depending on the actions (reducers).
  • You can "dispatch" (or add) an action to the store. Once you have, all your defined reducers will run.
  • Your reducer functions are basically switch/case statements for the type of action. Once you've matched with an action, your function is to return the mutation.

An example, let's say your store is { user: "johnson1" }:
dispatch({ type: "LOG_OUT" }) -> reducer match of action "LOG_OUT" -> return { user: null } -> redux updates store

Collapse
 
ogwurujohnson profile image
Johnson Ogwuru

Thanks alot for this, I appreciate