|
|
|
|
|
by hakanderyal
4172 days ago
|
|
In flux, all the data are stored in stores. When a component needs data, it subscribes to the relevant stores, and updates itself on data changes. When you want to mutate the data, you call an action, which in turns mutate the data in the store. Since the components are subscribed to stores, they get the new data automatically. Stores subscribe to a central dispatcher, listening to all actions. When an action fires, they look the action's data, and mutate their data if it is relevant to them. The data flow is action-> dispatcher-> store -> component -> action. When you want to get data from a rest endpoint, you fire an action from the component. The action fetches the data, and pushes it to dispatcher. |
|