littensy / rbxts-roact-hooked Goto Github PK
View Code? Open in Web Editor NEWRoact hooks based on Kampfkarren's implementation & React Hooks
License: MIT License
Roact hooks based on Kampfkarren's implementation & React Hooks
License: MIT License
Looking at the source code, withHookDetection() should return Roact?.
Functions like resolveCurrentComponent()
do not return the same component between different versions of roact-hooked. So, packages that provide useful hooks should use roact-hooked as a peer dependency.
However, should resolveCurrentComponent()
be consistent between different instances, anyways? It would keep track of rendering components with _G
to make it less error-prone.
Is this change worth it, or would a descriptive error message be enough?
const [attributeValue, setAttributeValue] = useState(instance?.GetAttribute(attribute));
useEffect(() => setAttributeValue(instance?.GetAttribute(attribute)), [instance, attribute]);
setAttributeValue()
claims it returns void
, but actually returns the new state.
In my case, this caused effect.destroy
to become true
:
https://github.com/littensy/rbxts-roact-hooked/blob/master/src/hooks.lua#L156
Which then caused this check to pass:
https://github.com/littensy/rbxts-roact-hooked/blob/master/src/hooks.lua#L150
Which then throws an error here, because it's doing coroutine.create(true)
:
https://github.com/littensy/rbxts-roact-hooked/blob/master/src/NoYield.lua#L30
Re-export the Roact API with in-built support for hooks. This should help simplify imports and code.
Would help to have hooks return lua tuples instead of arrays to make use in Luau easier
I don't want to keep this directory in src, but I do not know how to move it outside while also including it in roblox-ts for testing in Roblox Studio
Code should have unit tests instead of stories for better coverage.
Switch to exposing hooks through a "dispatcher" rather than having that logic be in a file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.