Flux Infrastructure
- ACTION - a simple class that defines the events that components may trigger
- DISPATCHER - a class that dispatches the events from the ACTION to the different STOREs
- STORE - a store catches the events, processes them and then fires a completion event that components may subscribe to
/model-view-whatever-(mvw)/model-view-controller-(mvc)/flux/flux-diagram.png)
Flux Flow Example
- when a button is clicked, it will call an action, which will trigger “INCREASE” event
- a STORE will respond to the event, calling to the server and actually modify the product’s quantity
- then the STORE will fire a “QUANTITY_WAS_CHANGED” event to notify whoever listens
- then each component that subscribed to the event will be notified and act accordingly