-
Notifications
You must be signed in to change notification settings - Fork 0
Reactive conditions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry about the late reply Kethan. Bruh is a bit unlike react in some ways; that const parity = r([count], () =>
count.value % 2 === 0
? "Even"
: "Odd"
)
return <div>{ parity }</div> |
Oh wow that's so simple. Before I tried with https://github.com/kethan/ulive instead of your reactivity it works like charm. |
@wlib is there a way I can implement a clean up function when component exits like i want to remove event listeners, etc ?? |
I'm not quite sure how to answer that because there is no component lifecycle, so there is no component unmounting. This may change in the future, but I'm trying to keep it as close to "standard html/js" as I can for future-proofing. The trouble with lifecycle methods is that they would force bruh to constrain how you use elements a little too much, as bruh's elements are nothing more than plain elements created with The HTML standard has moved towards If you could show me your exact use case I might be able to show you how I would do it. If I don't have a good solution right now, then it's something I will definitely need to think about how to add support for. |
Yes you right. But i do have an usecase i will try to share with you. It's just like solidjs oncleanup function it just cleans up old effects when run new effects. |
Hi, very nice library.
How do I under such conditions in the counter example?
The text was updated successfully, but these errors were encountered: