Flux

FLUX

before you get to react, know redux

before you get to redux, know flux

this is about flux

flux

describing flux as a team of people working together

1. the ACTION creator

takes input, turns it into actions, passes it to dispatcher

There’s a neat side effect to having a part of your system that knows all of the possible actions. A new developer can come on the project, open up the action creator files and see the entire API — all of the possible state changes — that your system provides.

2. the DISPATCHER

takes an action, passes it to all the stores registered to it, handles dependencies (pass to store 1, wait for result, then pass to store 2)

controls when to tell which store to do what

3. the STORE

go through all actions taken from DISPATCHER, make changes to state based on what it cares about, and tell CONTROLLER VIEW that the state has changed

only does stuff that they care about, in their own time

4. the CONTROLLER VIEW and the VIEW

controller view is the logic, view is the display endpoint

when the state has changed, take new state, turn state into html and pass it to the views.

HOW THEY ALL WORK TOGETHER (in flowchart)

chart