Let's take a look at the three principles of Redux:
- Single source of truth: This means that the whole application state is stored in a single object. In a real app, this object is likely to contain a complex tree of nested objects.
- State is read-only: This means that state can't be directly changed. This is a bit like saying we can't directly change the state within a component. In Redux, the only way to change state is to dispatch what's called an action.
- Changes are made with pure functions: The functions that are responsible for changing the state are called reducers.
In the following sections, we'll dive into actions and reducers a little more along with the thing that manages them which is what is called a store.