mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
11 lines
375 B
Text
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: () -> ()) -> () -> ())
|