Shashank Trivedi
Posted on September 18, 2024
Redux is a state management library that follows a few core principles and philosophies:
Single Source of Truth:
1. In Redux, the entire application state is stored in a single object tree inside a single store. This ensures that all data is centralized, making debugging, testing, and managing the application easier.
2. This "single source of truth" also makes the application state predictable, as any state change happens through explicit actions.
State is Read-Only:
The only way to change the state in Redux is by dispatching actions. Actions are plain objects that describe "what happened" but do not directly mutate the state. The reducers, which are pure functions, handle these actions and return a new state based on the action's type and payload.
Changes are Made with Pure Functions:
Reducers are pure functions that take the current state and an action and return a new state. They must be predictable, without side effects, and always produce the same output given the same input.
This makes state transitions more predictable and easier to reason about.
Posted on September 18, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.