Answer» - At the first start of the app, the main THREAD starts execution and starts loading JS bundles.
- When JavaScript code has been loaded SUCCESSFULLY, the main thread SENDS it to another JS thread because when JS does some heavy calculations stuff the thread for a while, the UI thread will not suffer at all times.
- When React starts rendering, Reconciler starts “diffing”, and when it generates a new virtual DOM(layout) it sends changes to another thread(Shadow thread).
- Shadow thread calculates layout and then sends layout parameters/objects to the main(UI) thread. ( Here you may wonder why we call it “shadow”? It’s because it generates shadow nodes )
- Since only the main thread is able to render something on the screen, the shadow thread should SEND the GENERATED layout to the main thread, and only then UI renders.
|