Flux è un pattern architetturale (da Facebook) per gestire lo stato con flusso dati unidirezionale (a senso unico). È stata la base concettuale per Redux e ha influenzato la maggior parte delle librerie di state management moderne. L'idea centrale: i dati fluiscono in una direzione singola e prevedibile.
Il ciclo unidirezionale
Action → Dispatcher → Store → View
↑ │
└───────────────────────────────────┘
(user interaction creates a new Action)
1. Action — a plain object describing WHAT happened ({ type: 'ADD_TODO', text })
2. Dispatcher — a central hub that sends every action to the stores
3. Store — holds state + logic; updates itself in response to actions
4. View — renders from the store; user interactions dispatch new actions
