Re:Preact Signals
by eyelidlessness on Tuesday September 06, 2022 @08:19PM
(#32744845)
I think this is very spiritually similar to the intent of Solid, and Solid’s creator often cites Knockout as an inspiration. I haven’t even looked at his Twitter yet since this announcement but I expect he’ll have a lot of nuance to offer on the subject.
At a very high level, the thing that this offers versus (anything) is a very minimal reactivity solution that’s small and designed specifically to be integrated into Preact’s VDOM. Other than that, it’s a whole lot of details at a level that most people won’t care about beyond the minutiae of implementation and the nuance people actively implementing these libraries can provide.
Afaict this allows you to retain the one-way data model that makes react easy to reason about. This is simply one way to handle your data model (vs "useState", for example). You'd have actions that update the signals (they seem more or less to be streams), and then your components are pure functions of the signal data.
I also noticed the similarity to Knockout. The main difference in the API seems to be the use of a value property vs. Knockout's function call to access the value.
The computed function seems almost identical.
To me the brilliance of React is the VDOM, which allows you to treat your components like a render loop in a game.
What’s the piece that I’m missing that separates Signals from RxJS observables?