Root
Entry point for rendering Dex applications.
In order to write a Dex application, you need to first create a root via Dex.Root, and render an instance using Root:Render()
-- Create our Dex application
local App = Dex.Premade("ScreenGui", {}, {
Label = Dex.Premade("TextLabel", {
Text = "Hello, World!",
})
})
-- Render our Dex app over a premade ScreenGui template named "App"
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local root = Dex.Root(PlayerGui:WaitForChild("App"))
root.Render(App)
Constructor
Dex.Root
Dex.Root(hostInstance: Instance) -> Root
Creates a new Root instance. The Root is a reference to a real Roblox Instance and can render VirtualInstances using Root:Render.
Functions
Render
Reconciles a Virtual Instance into the root's Roblox Instance. After the call, the Virtual Instance is sealed and cannot be mutated. Instead, you should use Dex Observers to mutate the Instance after reconciliation.
It returns the Reconciled Node.
Unmount
Root:
Unmount
(
) →
(
)
Unmounts the Virtual Instance from the Root, causing it to be deleted from the DataModel.
Destroy
Root:
Destroy
(
) →
(
)
Unmounts and destroys the Root and its underlying Roblox Instance. This function should be called before discarding a Root object to ensure memory is properly freed.