Redux FUZZ

admin
By -
0

Before start understand pillars

Redux complete workflow

1

React Component

User clicks Increment button

2

Dispatch

dispatch({ type: "INCREMENT" })

3

Action

Describes what happened: INCREMENT

4

Reducer

Receives old state + action and calculates new state

5

Store

Holds the updated state

6

Selector

Reads the required data from the store

7

React Component

Gets updated data and re-renders the UI

Example with count = 0

Step

What happens

Value

1

User clicks button

Increment

2

Dispatch sends action

INCREMENT

3

Action is created

INCREMENT

4

Reducer calculates

0 + 1

5

Store updates

count = 1

6

Selector reads state

1

7

UI displays

Count: 1

Remember the sequence:

Component → Dispatch → Action → Reducer → Store → Selector → Component

This is called Redux Unidirectional Data Flow.

 

Redux Workflow Architecture

①

React Component

User clicks the Increment button

↓
②

Dispatch

dispatch({ type: "INCREMENT" })

↓
③

Action

Describes what happened: INCREMENT

↓
④

Reducer

Receives previous state + action

Calculates the new state

↓
⑤

Store

Holds the updated application state

↓
⑥

Selector

Reads required data from the store

↓
⑦

React Component

Receives updated data and re-renders UI

Redux follows Unidirectional Data Flow




For  more simple expalint we using two  story



Story 1: 911 Emergency System 🚨

Imagine an accident happens.

  1. Component: A person reports an accident.

  2. Dispatch: Sends the emergency report.

  3. Action: Describes what happened (accident reported).

  4. Reducer: Processes the report and decides how the incident status changes.

  5. Store: Keeps the current incident information.

  6. Selector: Checks the latest incident status.

  7. Component: Displays the updated status.

Story 2: Pizza Ordering System 🍕

Imagine you order a pizza through an app.

  1. Component: Customer clicks Order Now.

  2. Dispatch: Sends the order request.

  3. Action: Describes the order (one cheese pizza).

  4. Reducer: Processes the order and updates its status.

  5. Store: Keeps order details and status (Preparing).

  6. Selector: Reads the current order status.

  7. Component: Displays "Your pizza is being prepared!"

Easy way to remember

Redux

Simple meaning

Component

Where user interacts

Dispatch

Sends information

Action

What happened

Reducer

How state changes

Store

Where state is kept

Selector

Reads state

Component

Shows updated result

Both stories follow the same flow:

Component → Dispatch → Action → Reducer → Store → Selector → Component



  • Action: The event that happened (e.g., "Need ambulance").

  • Dispatch: The messenger/trigger (dispatch(action)) that carries the action into the system to start an update.

  • Reducer: The function that takes (currentState, action) and calculates the new state. It returns that new state straight to the Store—you don't call dispatch again to save it.

  • Store: Holds the updated state.

  • Selector: Picks out just the exact piece of data your UI Component needs (like only the ambulance status), so the component re-renders with the latest info.

The Clean 911 Flow Story

An emergency happens (Action), you send it through Dispatch to the Reducer, which computes the new status for the Store, and a Selector pulls that specific status onto the screen (UI) to show the update.

Imaginary story to exampling concept:


It is a busy Tuesday evening inside the Metro 911 Call Center, where the entire city’s emergency response depends on one strict rule: nobody changes the official records directly. At the front desk sits Hannah, our UI Component. Her screen is the face of the operation, displaying live emergency updates and waiting for incoming reports. Suddenly, her headset lights up with an urgent call—there has been a multi-car accident on 5th Avenue, and paramedics are needed immediately.

Hannah cannot walk over to the central system and erase or rewrite anything herself. Instead, she types out a clean, standardized emergency ticket labeled "NEED_AMBULANCE" with the exact location, 5th Avenue. In Redux terms, this emergency ticket is the Action. It does not contain any instructions on how to solve the crisis or which vehicle to move; it is simply a plain record describing what just happened.

Once the ticket is ready, Hannah hands it to Tyler, who acts as Dispatch. Tyler is the dedicated runner and communication channel of the headquarters. He does not open the ticket to analyze it, nor does he have the authority to alter any records on his own. His only responsibility is to take that Action and deliver it straight into the main control room to trigger an official update.

Inside the control room sits Chief Christin, the Reducer. Christin is the calm, rule-bound decision-maker who controls how the city’s status evolves. When Tyler drops the "NEED_AMBULANCE" ticket on her desk, Christin looks at two things: the current emergency records and the new ticket in front of her. Following strict departmental protocol, she does not scribble over old paperwork. Instead, she writes out a brand-new status sheet that preserves all existing city data while assigning Ambulance #4 to 5th Avenue. She then hands this updated sheet directly to the Master Command Board, which is the Store—the single source of truth holding the complete, up-to-date state of every emergency across the city.

Across the control room stands Claire, the Selector. While the Master Command Board tracks hundreds of details—from fire trucks and police patrols to weather alerts—Hannah’s front-desk screen only cares about active ambulance dispatches. Claire keeps a sharp eye on the Store, and the moment Chief Christin updates the board, Claire extracts only that single slice of ambulance data, ignoring everything else.

Claire immediately sends that specific ambulance update straight back to Hannah’s monitor. Hannah’s screen refreshes automatically, flashing the live status: "Ambulance #4 Dispatched to 5th Avenue." Through this smooth, one-way loop—from Hannah’s Action, carried by Tyler’s Dispatch, calculated by Chief Christin’s Reducer, saved in the Store, and filtered by Claire’s Selector—the entire emergency center stays synchronized without a single lost record.


Post a Comment

0Comments

Put Your Thought or Query Here

Post a Comment (0)