Understanding Flux Architecture

William Wambua
The Startup
Published in
4 min readNov 23, 2020

--

Flux is an architectural pattern for building data layer for JavaScript applications. Flux focuses on creating an explicit and understandable data flows i.e. unidirectional data flow which increases predictability of application code.

Flux comparison to MVC

MVC short for Model, View, Controller is a client-side architecture. In this architecture, a user interaction on View prompts the controller which in turn calls one or more Models. When data in the model changes, the views are notified with the new data and they can update themselves.

The major drawback for MVC comes about as the application becomes larger. As an application using MVC grows, new models, views and controllers are added.

The dependency graph becomes more complex. This means that a single interaction on a View, multiple paths of execution happen. Tracing a bug in such an application becomes harder over time and can slow down implementation of new features.

The MVC pattern is illustrated in the diagram below:

MVC Architecture Diagram

Flux on the other hand avoids this design and focuses on single directional data flow.

--

--