Using with Elements
How to bind State to element props and computed props
Overview
Bind state directly to props by passing the State object or using computed functions that read :get().
local State = Katalyst.State
local New = Katalyst.New
local count = State(0)
local label = New("TextLabel")({
Text = function()
return "Count: " .. count:get()
end,
})
-- or bind the State directly
local label2 = New("TextLabel")({
Text = count,
})Notes
- When passing a
Statedirectly, the instance property is set to the state's current value and will update as the state changes.
