- Mastering Immutable.js
- Adam Boduch
- 211字
- 2021-07-08 10:30:04
What other direction is there?
The best way to visualize unidirectional data flow is in a top-down fashion. Data starts in one state at the top, changes state as it flows downward, ending with a side-effect that does something with the data. When this is enforced as a property of the architecture, side-effects are predictable. We can easily trace the starting point of data, through the transformations it makes, ending with the visible side-effect.
When we don't enforce a unidirectional data flow, it's difficult to trace cause and effect. This is the main reason that Facebook started promoting the concept with the creation of Flux—to prevent components from changing state at will and passing the changed state on to another component. For example, let's say that you aren't using immutable data, and that one component changes its state in response to an event. Then some other component that references this state renders itself, causing its state to change as a result of the first change. These are nothing more than uncontrolled side-effects.
Immutable.js is a low-level library compared to the ideas of Flux or a UI component library such as React. Even if you're not using either of these, you can still leverage Immutable.js to build a unidirectional architecture.
- 復雜軟件設計之道:領域驅動設計全面解析與實戰
- C#程序設計實訓指導書
- Oracle從新手到高手
- Learning Elixir
- Spring Cloud、Nginx高并發核心編程
- HTML5與CSS3基礎教程(第8版)
- C語言程序設計
- 速學Python:程序設計從入門到進階
- Python數據可視化之美:專業圖表繪制指南(全彩)
- Julia High Performance(Second Edition)
- Microsoft Exchange Server 2016 PowerShell Cookbook(Fourth Edition)
- 產品架構評估原理與方法
- 從零開始學UI設計·基礎篇
- Test-Driven Java Development(Second Edition)
- SQL Server 2014從入門到精通