-- Compiled with roblox-ts v3.0.0 local TS = _G[script] local useHookState = TS.import(script, script.Parent.Parent, "topo").useHookState --[[ * * * @param initialValue - The initial value of the state. * @param discriminator - An optional value to additionally key by. * @param key - An automatically generated key to store the state. * @returns A tuple containing the current state value and a function to update it. * @metadata macro ]] local function useState(initialValue, discriminator, key) local _key = key assert(_key ~= "" and _key, "Attempted to use useState without a key.") local storage = useHookState(key, discriminator) if not storage.data then storage.data = { value = initialValue, } end return storage.data.value, function(newValue) storage.data.value = newValue end end return { useState = useState, }