Post

tried writing this blog 3 times but it’s really boring, so here’s the short version: React won. Every mainstream f/w now implements its ideas, and developed their own ecosystems. The ones that didn’t, lost and died. This implies there’s no _strong_ reason to not pick one of the other winners.

Without a compiler, and with the virtualized DOM paradigm, I don’t really know that react is in a great position to benefit from signals. Frameworks that use compilers and “templated“ DOM (including JSX usage) will always have an advantage using any reactive primitive for targeted updates

Put differently, if we react has to build an object tree, and then diff it against another object tree in order to know what to update, then targeted updates aren’t really on the table. And reactive types like signals really don’t have any direct advantage for react.

Admittedly the things I was looking for was: - Small (Preact's got) - No auto tracking (explicitness in library code) - Any side effects being "mountable" and unmountable (namely for React support) - Ability to diff new vs previous values so we can keep referencial stability between computations

To be clear: absolutely not against using someone else's signals implementation if it ticks those boxes. (Or even wrap our own) The "Store" implementation is probably really bad, given I have written it naively (hard to find non-whitepaper reading on topic)

0 reposts4 likes

Tbh preact's does tick all of those. It might be worth a try. It's also entirely free of memory bookkeeping - you never have to worry about destroying or cleaning up state, as it's all left to the JS engines garbage collector.

Mostly just a preference for explicitness > implicitness Keep in mind, our main intention with "Store" isn't to be powering application code (where auto tracking saves from bugs more often than it prevents them) Instead, it's to attempt as much fine-grained control over what computes when in a lib

For your case, it sounds like you would just use the .subscribe() method on signals. Benefits would be the graph optimizations, battle-testedness and size. Also interop! Our signals are valid Svelte Stores.