Skip to content

Instantly share code, notes, and snippets.

@Jlevyd15
Last active February 1, 2017 18:04
Show Gist options
  • Save Jlevyd15/2e25113b589603e6e643b9d8ef5c1167 to your computer and use it in GitHub Desktop.
Save Jlevyd15/2e25113b589603e6e643b9d8ef5c1167 to your computer and use it in GitHub Desktop.
Notes on Redux

Actions - actions are POJO that have two properties.

  • they contain a type and a payload.
  • Type: is basically a name for the action. Ex: TYPE: INCREMENT
  • Payload is state
  • we use these in Redux to pass as arguments to dispatchers we say dispatch an action

Reducers - reducers are pure functions that receive actions

  • they hold the state of the application in something called a store,
  • reducers contain the logic behind the action and actually do the thing to alter the state.
  • normally these are like switch statments that decide what will happen to state when a given action is called
  • they take two arguments 1. previous state 2. the action type
  • returns an object containing the updated state

Components - these are basically the UI of the application

  • they receive the state data and display it on the DOM
  • usually these are organized into two types 1. containers 2. components
  • containers are smart they contain some logic
  • components are usually dumb and can be stateless functional components, which just render something from a parent container

Store - stores are behind the scene redux mechinisim to hold the state data

  • stores interact with reducer functions to keep the state updated.
  • stores contain the state date

1 way data binding diagram

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment