Show HN: A tiny and fast reactive observables library via functions
21–30 of 41 posts
Re: Show HN: A tiny and fast reactive observables library via functions
#22Nice! I love these tiny libraries. Some random thoughts: - I like that the effect function returns a disposer. - I don't entirely understand what it means to dispose of observables, is that just an internal optimization for cleanups basically? Exposing an API for this feels a bit risky, like it feels easy to misuse. - Batching everything feels interesting, no "am I in a batch or not?" problems anymore, though I quite…
In MobX there are various things that have to be manually cleaned up at different times to avoid memory-leaks, since reactive systems like this involve a lot of cross-references. I could imagine eg. that cleaning up an observable in this library releases references to all memoized values that were derived from it
Re: Show HN: A tiny and fast reactive observables library via functions
#23Surprising no one mentioned here about https://github.com/staltz/xstream Creaed by Andre Staltz, the creator of cycleJS and other interesting reactive libraries in JS. xstream is powerful and also much smaller in size. Give that a try.
Re: Show HN: A tiny and fast reactive observables library via functions
#24Re: Show HN: A tiny and fast reactive observables library via functions
#25So I just started a new side project, and I'm using JS without a framework for the first time in over 5 years. I poured over several state management libraries before just deciding to write a naive solution on my own. I've got a very simple stateful class - the data model itself is private, and it has a custom getter/setter for access. The setter broadcasts a custom event for each top-level key that changed. Super si…
At least for what I made, I don't think it's too complex for what it provides. It transparently integrates with the event loop and only runs what it needs to, at the cost of (min-brotli) 432 bytes at the moment. Compare the "naive" SimpleReactive with the complete FunctionalReactive version here: https://github.com/Technical-Source/bruh/blob/main/packages/...
Re: Show HN: A tiny and fast reactive observables library via functions
#26Another notable reactivity lib is Vue's reactivity parts.
For example: you have an observable foo, and it has an array bar. You can read foo.bar directly instead of needing a wrapper getter function. You can also update foo.bar = … instead of needing a setter function. You can also call foo.bar.sort() and Vue will pick this up.
I see lots of small reactive libraries but a lot of them will not pick up something like foo.bar.sort().
Re: Show HN: A tiny and fast reactive observables library via functions
#27https://github.com/jbreckmckye/trkl
I've used this for production sites where bytes down the wire is a hard constraint.
Re: Show HN: A tiny and fast reactive observables library via functions
#28Looks interesting... One critique is "light/tiny/lightweight" whenever I read about software being "light" I cringe and get an eye-twitch(ok not really). But adding "light" or claiming your product is "light" means usually nothing other than its new . Sure it might start out as small/lightweight but usually this is because the software is new . Once you start adding in corner-cases (the ones you haven't even thought…
Re: Show HN: A tiny and fast reactive observables library via functions
#29Hey everyone! I put together a functional reactivity library that uses observable functions as it's primitive for tracking state and changes. It's super tiny (850B), fast, only re-computes the dirty parts of a computation tree, batches updates via a scheduler on to the microtask queue, and works in both browsers and Node. Love any feedback :)
$a(); // read $a.set(20); // write (1) $a.update((prev) => prev + 10); // write why not $a(20) and $a(prev => prev + 10)?
Re: Show HN: A tiny and fast reactive observables library via functions
#30Looks interesting... One critique is "light/tiny/lightweight" whenever I read about software being "light" I cringe and get an eye-twitch(ok not really). But adding "light" or claiming your product is "light" means usually nothing other than its new . Sure it might start out as small/lightweight but usually this is because the software is new . Once you start adding in corner-cases (the ones you haven't even thought…
For example, if the core goal of the library is to achieve <2kB and you've predetermined a tight API scope (most likely based on existing references) then IMO it's okay to call it tiny/lightweight. It works out with libraries that are a providing a set of primitives to solve a generalized problem. I'm sure some people appreciate like I do when a library clearly indicates a core goal that was achieved (i.e. size) right in the top-level description.