What are the core principles of Redux?
Redux is built on three fundamental principles:
-
Single Source of Truth
The entire state of the application is stored in a single JavaScript object inside a store.
This makes the state easy to inspect and debug. -
State is Read-Only
The only way to change the state is to emit an action, an object describing what happened.
This ensures that nothing outside of the authorized flow can directly modify the state. -
Changes are Made with Pure Functions
To specify how the state tree is transformed by actions, you write pure reducers.
A pure function means the same inputs will always produce the same outputs, without side effects, making changes predictable and testable.
These principles make Redux applications more maintainable, scalable, and predictable.