Redux Principles

Understand the underlying principles of Redux.

The three principles of Redux

Redux is based on the following three principles:

  • A Redux app should have a single source of truth called the store.

  • The store is read-only and is mutated solely by dispatching actions.

  • Changes to the store are made using pure functions called reducers.

Let’s discuss each principle in detail.

The first principle

In Redux, we keep our application’s state in a single JavaScript object called the store. The components/views of our applications subscribe to the store for required data.

Exercise: Create a store

Let’s create our first store from scratch:

  1. Declare a variable named ...