Class-37 Readings: Redux - Combined Reducers


Class-37 Readings: Redux - Combined Reducers

Table of Contents

Reading, Research, and Discussion

1. Why choose Redux instead of the Context API for global state?

  • As an application grows redux is more readable and performs better in certain cases.

2. What is the purpose of a reducer?

  • It is a pure function that takes a previous state and an action to update state. I will return the next version of the state.

3. What does an action contain?

  • Actions have payloads of information that sends data to your store. This is how a store gains its information via dispatch

4. Why do we need to copy the state in a reducer?

  • The reducer uses this state and the action to update the copy then return you the next state.

Vocabulary Terms

  • immutable state :
  • time travel in redux :
    • def: The ability to move back and forth among the previous states of an application and view the results in real time.
  • action creator :
    • def: An action creator is merely a function that returns an action object.
  • reducer :
    • def: The reducer is a pure function that takes the previous state and an action, and returns the next state. (previousState, action) => nextState. It’s called a reducer because it’s the type of function you would pass to Array.
  • dispatch :
    • def: dispatch() is the method used to dispatch actions and trigger state changes to the store.

Additional Resources

Bookmark / Skim