Added intro to OVERVIEW

This commit is contained in:
Brian Vaughn
2019-02-28 13:46:36 -08:00
parent c249e31932
commit d70dbfdb65
+8
View File
@@ -1,5 +1,13 @@
# Overview
The React DevTools extension consists of multiple pieces:
* The "frontend" portion is the extension you see (the Elements tree, the Profiler, etc.).
* The "backend" portion is invisible. It runs in the same context as React itself. When React commits changes to e.g. the DOM, the backend is responsible for notifying the frontend by sending a message through the "bridge".
One of the largest performance bottlenecks of the old React DevTools was the amount of bridge traffic that was sent. Each time React committed an update, the backend sent every fiber that changed across the bridge, resulting in a lot of (JSON) serialization. The primary goal for the DevTools rewrite was to reduce this traffic. Instead of sending everything across the bridge, the backend could only the minimum amount required to render the Elements tree and the frontend could request more information (e.g. an element's props) on demand, only as needed.
The old DevTools also rendered the entire application tree in the form of a large DOM structure of nested nodes. A secondary goal of the rewrite was to avoid rendering unnecessary nodes by using a windowing library (specifically [bvaughn/react-window](https://github.com/bvaughn/react-window)).
## Serializing the tree
Every React commit that changes the tree in a way DevTools cares about results in an "_operations_" message being sent across the bridge. These messages are lightweight patches that describe the changes that were made. (We don't resend the full tree structure like in legacy DevTools.)