← Lessons

quiz vs the machine

Silver1050

Frontend

The Flux Architecture

The unidirectional data flow pattern that inspired modern state management libraries.

4 min read · intro · beat Silver to climb

What it is

Flux is an architecture for building client side applications around a strict one way data flow. It was created to tame the tangle of two way bindings where views and models update each other unpredictably.

The four parts

  • Action: a plain object describing what happened, such as add item with a payload.
  • Dispatcher: a single hub that receives every action and forwards it to stores.
  • Store: holds state and the logic for a domain; it updates only in response to actions.
  • View: renders from store data and emits new actions on user input.

Why one direction matters

Because data flows in a single loop, you can always answer the question of how the state reached its current value. There is exactly one path to mutation, so debugging becomes tracing a sequence rather than chasing hidden links.

  • No view writes directly to another view.
  • All change starts as an action.
  • Stores never pull from each other in a cycle.

Key idea

Flux replaces tangled two way binding with a single predictable loop where actions flow through a dispatcher to stores and finally to views.

Check yourself

Answer to earn rating on the learn ladder.

1. What enforces the single point of entry for changes in Flux?

2. What is the main benefit of unidirectional data flow?