react-devtools中"highlightUpdates"选项的各种高亮颜色是什么意思
In react-devtools, what do the various highlighting colors of the "highlightUpdates" option mean
我一直在使用 react-devtools 来检测任何不必要的组件更新,但是我不确定我是否完全理解它是如何工作的。
我可以识别通过添加的边框更新的各种组件,表明它们已更新,但我不确定这些边框的各种颜色是什么意思(到目前为止我看到的是青色和浅绿色) .
这个我也不是很懂,我会追查代码的! :)
This is the component that renders the "Highlight Updates" toggle. It calls a changeTraceUpdates
method in the main Store
which sends a message through the "bridge" to activate the TraceUpdatesBackendManager
. Poking around that file, we see a couple of classes with names like "presenter" in them; I assume one of these is what actually draws the border. In particular, TraceUpdatesWebNodePresenter
looks related because it defines an array of COLORS
. It looks like these colors are chosen based on a "hit" attribute, which a quick search suggests is set by TraceUpdatesAbstractNodePresenter
– and gets incremented each time an element is "presented".
那么从字里行间来看,我假设这意味着渲染频率较低的组件将用 "cool" 颜色(蓝色)勾勒出轮廓,而渲染频率较高的组件将用 "hot" 颜色勾勒轮廓(红色).
我一直在使用 react-devtools 来检测任何不必要的组件更新,但是我不确定我是否完全理解它是如何工作的。
我可以识别通过添加的边框更新的各种组件,表明它们已更新,但我不确定这些边框的各种颜色是什么意思(到目前为止我看到的是青色和浅绿色) .
这个我也不是很懂,我会追查代码的! :)
This is the component that renders the "Highlight Updates" toggle. It calls a changeTraceUpdates
method in the main Store
which sends a message through the "bridge" to activate the TraceUpdatesBackendManager
. Poking around that file, we see a couple of classes with names like "presenter" in them; I assume one of these is what actually draws the border. In particular, TraceUpdatesWebNodePresenter
looks related because it defines an array of COLORS
. It looks like these colors are chosen based on a "hit" attribute, which a quick search suggests is set by TraceUpdatesAbstractNodePresenter
– and gets incremented each time an element is "presented".
那么从字里行间来看,我假设这意味着渲染频率较低的组件将用 "cool" 颜色(蓝色)勾勒出轮廓,而渲染频率较高的组件将用 "hot" 颜色勾勒轮廓(红色).