
Alt - as a library supporting the Flux architecture.This set of libraries will be used to create the app: In vanilla implementation of Flux there is also a dispatcher - but I won’t cover it in this blogpost.Įnough theory, get to the code! Starting from scratch - creating an environment Components gets data from stores and emits actions, which updates stores. The very interesting (and helpful) part of this architecture is that it creates unidirectional data flow. Stores subscribe to actions - everytime someone triggers the action, the registered store is notified about it. That’s why Flux have the concept of actions. Since store data can change, there must be something which triggers the change. It simplifies the flow of data in your application. Stores allow components in deeper levels of components tree to get data directly. You can listen to as many stores as you like in your component. Why I should use Flux?įlux with it’s tooling allows us to set data flow in components in a more ‘free’ way. Simplicity of this app would allow you to see a basic flow without distractions. You can see the full flow in a video at the top of this post. You can also see a list of existing tasks. You can add task to it, as well as removing it. As a bonus, I’ll show you how to use Immutable.js to improve performance of your React components. I would like to show you step-by-step how to create a simple application, backed by a Flux architecture. I personally was daunted when I tried to choose one.īut an idea is the most important part of the architecture. Asynchronicity support, immutability as a core, ability to be isomorphic, or more functional approaches are usual ‘ideals’ behind them. They come in different flavors and ideals in mind. There are lots of libraries which help with building an app with Flux architecture. You may heard about it if you are interested in React. It specifies how your data flows thorough the whole front-end stack. It is a relatively simple idea, taking an inspiration from the CQRS architecture. One of the most interesting ideas behind React is how the whole front-end application is structured.įlux is an interesting approach to structurize front-end apps. There are many awesome tools that can work along with React really well. React.js comes with a variety of tools and ideas behind it.
