vide/src/mount.luau
2024-11-13 22:19:20 +00:00

11 lines
375 B
Text

local root = require "./root"
local apply = require "./apply"
local function mount<T>(component: () -> T, target: Instance?): () -> ()
return root(function()
local result = component()
if target then apply(target, { result }) end
end)
end
return mount :: (<T>(component: () -> T, target: Instance) -> () -> ()) & ((component: () -> ()) -> () -> ())