The Vue 3 rendering process begins with createApp(APP).mount('#app'). The high-level execution sequence is as follows:
- App Creation:
createApp initializes the renderer and creates the app instance. - Mounting:
app.mount creates a VNode for the root component and invokes the render function. - Patching: The
render function calls patch, which leads to processComponent and then mountComponent for the initial render. - Instance Initialization:
mountComponent creates a component instance via createComponentInstance and initializes it using setupComponent. - Effect Setup:
setupRenderEffect creates the reactive effect that manages the component's updates and initial DOM insertion.
// High-level flow
app = createApp(APP)
app.mount('#app')
-> createVNode(APP)
-> render(vnode, container)
-> patch(null, vnode, container)
-> processComponent(...)
-> mountComponent(vnode, container, null)
-> createComponentInstance(vnode, null)
-> setupComponent(instance)
-> setupRenderEffect(instance, vnode, container)