You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change detection is a central problem in UI development, and JavaScript frameworks attempt to solve it in various ways.
Server-Side Rendering: Reset The Universe
"There is no change. The universe is immutable."
First-gen JS: Manual Re-rendering
"I have no idea what I should re-render. You figure it out."
Ember.js: Data Binding
"I know exactly what changed and what should be re-rendered because I control your models and views."
AngularJS: Dirty Checking
"I have no idea what changed, so I'll just check everything that may need updating."
React: Virtual DOM
"I have no idea what changed so I'll just re-render everything and see what's different now."
When a React UI is rendered, it is first rendered into a virtual DOM, which is not an actual DOM object graph, but a light-weight, pure JavaScript data structure of plain objects and arrays that represents a real DOM object graph.
A separate process then takes that virtual DOM structure and creates the corresponding real DOM elements that are shown on the screen.
Then, when a change occurs, a new virtual DOM is created from scratch. That new virtual DOM will reflect the new state of the data model.
React now has two virtual DOM data structures at hand: The new one and the old one. It then runs a diffing algorithm on the two virtual DOMs, to get the set of changes between them.
Those changes, and only those changes, are applied to the real DOM: This element was added, this attribute's value changed, etc.
So the big benefit of React, or at least one of them, is that you don't need to track change. You just re-render the whole UI every time and whatever changed will be in the new result.
The virtual DOM diffing approach lets you do that while still minimizing the amount of expensive DOM operations.
技术
element-ui-admin
理解数据驱动视图
Change And Its Detection In JavaScript Frameworks
React Virtual DOM vs Incremental DOM vs Ember’s Glimmer: Fight
Feature request: support multiple _mockserver.json files
技术的热门度曲线
聊聊技术选型 - Angular2 vs Vue2
玩转npm
单页应用 - Token 验证
个人可以申请微信小程序了
Git
产品
Focusky
AppStop – 一键生成 iOS 应用介绍页面
The text was updated successfully, but these errors were encountered: