## 2.1?以前是如何操作 DOM 的 (Mutable)
1. query 到 DOM 上一個元素
2. 改吧改吧
##2.2?Virtual DOM (Immutable)
1. 想好要往 DOM 上放什么東西
2. 把它給 Virtual DOM
3. Virtual DOM 決定哪些應該修改 DOM 哪些不用
為什么說前者是 Mutable 后者是 Immutable,這是相對你的業務邏輯來說的。
DOM 本身是 Mutable 的東西,把它柔和到你的業務上給你的邏輯加上了不少 mutable 的因素,而 Virtual DOM 成功的屏蔽掉了 mutable 的 DOM,每次 render 的 Component 其實都是新的,并不是以前 Component 的修改。
所以使用 Virutal DOM
* 容易 reason about, 因為 immutable
* 快
* 把緊耦合編程了高內聚
- 1. Why not 2 way binding/為毛不用雙向綁定
- 2. What's Virtual DOM, why should we care / 為毛要用 Vitual Dom
- 3. Why Immutable / 為毛要不可變
- 4. How to do Unit test React project / 如何單元測試
- 5. Modular and Components
- 6. How should I thinking in react way / 如何以 React 的方式解決問題
- 7. What about Data Fetching / 只有 V 的話,數據 M 呢
- 8. What about Router / router 怎么辦
- 9. How to communicate between two components that don't have a parent-child relationship/ 不是父子關系的 component 怎么交互
- 10. When should I use "key" / 什么時候該用 key
- 11. What's these Warnings / 這些黃黃的是神馬
- 12. How to Profile Component Perfomance / 如何提升效率