Here we are exposing on the render context and binding it to the div as its ref via . In the Virtual DOM patching algorithm, if a VNode’s key corresponds to a ref on the render context, the VNode’s corresponding element or component instance will be assigned to the value of that ref. This is performed during the Virtual DOM mount / patch process, so template refs will only get assigned values after the initial render.
Usage inside v-for
Composition API template refs do not have special handling when used inside . Instead, use function refs to perform custom handling: