Chapter 6. Redux

 

This chapter covers

  • Managing your application state with Redux
  • Implementing Redux as an architecture pattern
  • Managing your application state with actions
  • Enforcing immutability with reducers
  • Applying middleware for debugging and asynchronous calls
  • Using Redux with React

Redux is a library that provides an architecture for writing your business logic. With React apps, you can handle much of your application state within your root components. But as your application grows, you end up with a complex set of callbacks that need to be passed down to all the children in order to manage application state updates. Redux provides an alternative for storing your application state by doing the following:

  • Dictating a clear line of communication between your view and your business logic
  • Allowing your view to subscribe to the application state so it can update each time the state updates
  • Enforcing an immutable application state
Definition

Immutable objects are read-only. To update an immutable object, you need to clone it. When you change an object in JavaScript, it affects all references to that object. This means mutable changes can have unintended side effects. By enforcing immutability in your store, you prevent this from happening in your app.

6.1. Introduction to Redux

6.2. Redux as an architecture pattern

6.3. Managing application state

6.4. Applying middleware to Redux

6.5. Using Redux with React components

Summary

sitemap