Flux is an architecture to help client-side application deal with data coming from several endpoints (API endpoints, websockets, user interaction, etc.).
The basic idea is that you're connecting to many endpoints, and when your "connectors" catch a new piece of data, they're dispatching actions
(through a dispatcher
).
Reducers
are listening to these actions. When they catch an event they're interested in (let's say UserReducer
catches an USER_DATA_UPDATED
event), they "do something" with the action.
Most often, they're just storing the data attached to the action somewhere, and returning their new "state". (their state represent a portion of the global store
).
Components
(views, basically), on the other hand, can be connected to many reducers (or to the whole store).
Thanks to a pure function (connect
), you'll describe what the component properties will be for a given state of the global store. Let's say your component only needs some users data and not pricing info for instance. You'll c