Method Mount
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Mount(VisualElement, VNode)
Mounts a VNode tree onto target, establishing it as a render root and performing
the initial render. Dispose the returned MountedTree to unmount.
public static MountedTree Mount(VisualElement target, VNode tree)
Parameters
targetVisualElementThe VisualElement to mount onto.
treeVNodeThe VNode tree to mount (V.Provider, V.Component, V.Div, etc.). Treated as immutable after V.Mount: to change content, Dispose and re-Mount, or express dynamic parts using hooks (UseState / UseStore / UseContext) inside child components.
Returns
- MountedTree
A handle for Unmount (dispose to tear down).
Remarks
An error no error boundary in the tree catches unmounts the whole tree, as React's root does: its effect
cleanups run as on any unmount, target is left without the tree's elements, and the
error is reported to OnUncaughtError. The handle stays valid, and
disposing it is still how the root is released.
Mount(VisualElement, VNode, MountOptions)
Mounts a VNode tree onto target as Mount(VisualElement, VNode) does,
with the root options React's createRoot takes.
public static MountedTree Mount(VisualElement target, VNode tree, MountOptions options)
Parameters
targetVisualElementThe VisualElement to mount onto.
treeVNodeThe VNode tree to mount, treated as immutable as in Mount(VisualElement, VNode).
optionsMountOptionsThe root options, which MountOptions describes.
Returns
- MountedTree
A handle for Unmount (dispose to tear down).