React and Redux

Most important words in Redux architecture:

  • Store
  • Dispatch
  • Actions
  • Reducer
  • State

Store

??


Reducer

Reducer is a function that recieves two parameters and returns a piece of the application state.

The first parameter is the current state, and the second is the action

function counter(currentState, action) { const DEFAULT_STATE = { count: 0, sum: 0}; }

Dispatch

Is a function that returns an action. Returns an object with the type property and can return extra data if necessary.


State

State is an object managed by STATE.

// this will return the state object from store const state = store.getState();

Action


Container (Smart Component)

Container is a react component that as a direct connection to the state managed by redux.

Pedro Luz
A personal blog by Pedro Luz about coding, coding, habit building, and a few things more.(Psst... I am open to opportunities.)
Reach out to me on your favorite social :)© 2020 Pedro Luz