Data Flow
suggest changeThis is an outline of a comprehensive overview.
The Flux pattern assumes unidirectional data flow.
- Action — a simple object describing an action
typeand other input data. - Dispatcher — the single action receiver and callback controller. Think of it as the central hub of your application.
- Store — contains the application state and logic. It registers a callback with the dispatcher and emits an event to the view when a change to the data layer has occurred.
- View — a React component that receives the change event and data from the store. It re-renders when something has changed.
As of Flux data flow, views may also create actions and pass them to dispatcher for user interactions.
Reversed
To make it clearer, we can start from the end.
- Different React components (views) get data from different stores about changes that were made.
A few components may be called controller-views, because they provide the glue code to get the data from the stores and to pass data down the chain of their descendants. Controller-views represent any significant section of the page.
- Stores can be described as callbacks that compare the action type and other input data for the business logic of your application.
- The dispatcher is the shared action receiver and callback container.
- Actions are nothing more than simple objects with a required
typeproperty.
Formally, you’ll want to use constants for action types and helper methods (called action creators).
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents