You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make a froact.createRef() function that returns { current: Instance }
with the code:
typeRef= { current: Instance }
localfunctioncreateRef(): Refreturnfroact.Roact.createRef()
end
As it turns out, you can do .current on Roact refs. We can type the ref property on Roblox instance components as { current: Instance } so that you'll never fuck up the type of refs ever!
We get the beautiful, absolutely amazing extravagance of branch-based luau type inference! This is absolutely invaluable.
oh, and while we're add it, add froact.useRef(hooks), instead of doing hooks.useMemo(froact.createRef(), {})
The text was updated successfully, but these errors were encountered:
not sure about this, actually, refs being typed as any is nice, because you can usually assume the value of a ref correctly, there's mostly not going to be a case where you really want to assert whatever it's value is. Getting autocomplete for .current is nice, but wow is it nit-picking.
Make a
froact.createRef()
function that returns{ current: Instance }
with the code:
As it turns out, you can do .current on Roact refs. We can type the
ref
property on Roblox instance components as{ current: Instance }
so that you'll never fuck up the type of refs ever!We get the beautiful, absolutely amazing extravagance of branch-based luau type inference! This is absolutely invaluable.
oh, and while we're add it, add
froact.useRef(hooks)
, instead of doinghooks.useMemo(froact.createRef(), {})
The text was updated successfully, but these errors were encountered: