hook-flow icon indicating copy to clipboard operation
hook-flow copied to clipboard

Question:What does the color on the picture mean ?

Open Mark24Code opened this issue 5 years ago • 3 comments

Question:What does the color on the picture mean ?

The colors don't seem to match the ones listed in Chrome's performance panel. So what is the color here saying?

截屏2020-03-15下午6 14 59

Mark24Code avatar Mar 15 '20 10:03 Mark24Code

I'd like to know too. If the yellow color means "the part handled by the browser", then how can the browser run effects?

Or, what is the mechanism between the browser and React, that tells React that "it's time to run effects because I've painted the screen"?

paroxyzm avatar Oct 04 '20 08:10 paroxyzm

I'd like to know about this too.

Maybe @donavon can help? Or point to some resource for further study?

01abhishekjain avatar Nov 21 '20 20:11 01abhishekjain

For anyone else confused, this is how I understand it:

  • A component can be in one of three distinct lifecycle phases (mount, update, unmount), represented by the columns in the diagram.
  • The actions (e.g. 'Render', Run Effect', 'Cleanup Effects', etc.) can occur in one or more of these phases. They are represented by the rows (they span the whole row, but are marked within a specific column - potentially confusing).
  • Whether or not any one of these given actions occurs during a lifecycle phase is indicated by the background colour of the column for any of these rows. If the background colour is faded, the action does not occur in that lifecycle phase. Conversely, if the background colour is vivid, then that action does occur during that particular lifecycle phase. This is the significance of the background colour.

An example: The (component) 'Render' action occurs whenever a component mounts or is updated. However, it does not occur when a component unmounts, hence the faded green background colour in the 'unmount' column. Similarly, 'Run lazy initialisers' only runs when a component first mounts, hence the rich background colour in the mount column, and fade in the case of the other two columns.

Nurou avatar Aug 22 '21 17:08 Nurou