-- basic example
local num = Accord.new(0, Guard.Number)
num:Connect(function(value, oldValue)
print(`num changed from {oldValue} to {value}`)
end)
-- react hook example
return function<T>(value: Accord.Accord<T>): T
local state, setState = React.useState(value:get())
React.useEffect(function()
local connection = value:connect(setState)
return function()
connection:disconnect()
end
end, { value })
return state
end
Distributed under the MIT License. See LICENSE for more information.