Live data from Hacker News

What Are Signals?

signia.tldraw.dev

41–50 of 63 posts

Re: What Are Signals?

#41
post #5

Earlier quoted context omitted.

Same here, I have been spreading mobx everywhere I have gone. There's usually some resistance but once people got used to automatic dependency tracking, they never go back. I've seen so many projects get bogged down in props hell, then gobs of context api and performance problems when too many things react at once. Mobx has been solving these problems for a long time now!

I recently started ripping Mobx out of my app. Mobx solved exactly 1 problem for me, which was passing data horizontally (to siblings/cousins) and even to non-React components. But now `useSyncExternalStore` solves that. No context needed. Can read and write state anywhere, even outside components. No "observe" or "track" shenanigans. Efficient updates (can listen to a subsection of the tree).

valtio is a modern mobx-like implementation that uses `useSyncExternalStore` (via useSnapshot - https://valtio.pmnd.rs/docs/api/basic/useSnapshot).

Its still not quite as nice as MobX, as passing larger objects down the component tree means you need to mix snapshot and non-snapshot state. But it makes me hopeful about `useSyncExternalStore`

Re: What Are Signals?

#42

I don't really understand why people like signals again. I used a signals-like reactive programming model in VueJS a while ago and hated that you could never be sure exactly where things were being changed. Thankfully it seems that the React creators and maintainers are not hopping on the signals train and are instead adamant about unidirectional dataflow with explicit mapping of state to UI, which, as has been the r…

Your 2 is not a signals drawback, but a SolidJS one.

I love signals in VueJS, and it doesn’t even preclude a redux-like/lite state- management library like Pinia.

Re: What Are Signals?

#43
post #2

At first I thought this was talking about Unix signals Then I thought for a moment it was talking about a "signal" in the information theoretical sense All I came away with was that they've invented a new name for event driven architectures and/or data flow programming. I know naming is hard but we need to stop overloading terms.

I was equally confused, it just needs a paragraph at the beginning explaining the context

Re: What Are Signals?

#44

I don't really understand why people like signals again. I used a signals-like reactive programming model in VueJS a while ago and hated that you could never be sure exactly where things were being changed. Thankfully it seems that the React creators and maintainers are not hopping on the signals train and are instead adamant about unidirectional dataflow with explicit mapping of state to UI, which, as has been the r…

If those two pieces of code do different things, it’s a bad library plain and simple lol.

I’ve implemented this pattern with mobx and those two pieces of code are equivalent.

In my opinion:

- Unidirectional data flow patterns prevent a class of problems junior developers tend to make but require much deeper discipline to keep the app understandable

- Conventional bi-directional data flow patterns are susceptible to junior developer mistakes but generally are hard to make unreadable

Re: What Are Signals?

#45
Building 'signal graphs' because views subscribe to err signals is an old hat for re-frame users who are benefiting from a clean and simple mechanism to react to data changes since forever.

Subscriptions grow from the leaf up to the root (which is a single app "db") and so computation is minimal. If something writes to the "db", only relevant subscriptions are recomputed and only views subscribing to those are "repainted".

Works like magic.

Re: What Are Signals?

#46
post #22

I don't really understand why people like signals again. I used a signals-like reactive programming model in VueJS a while ago and hated that you could never be sure exactly where things were being changed. Thankfully it seems that the React creators and maintainers are not hopping on the signals train and are instead adamant about unidirectional dataflow with explicit mapping of state to UI, which, as has been the r…

Elm managed to move away from signals back in 2016 (controversial at the time, but IMO a great move). https://elm-lang.org/news/farewell-to-frp

Controversial only because they were hard to learn and those that invested in learning lost that investment. The new architecture is so much better and not hard to explain.

Re: What Are Signals?

#47

I don't really understand why people like signals again. I used a signals-like reactive programming model in VueJS a while ago and hated that you could never be sure exactly where things were being changed. Thankfully it seems that the React creators and maintainers are not hopping on the signals train and are instead adamant about unidirectional dataflow with explicit mapping of state to UI, which, as has been the r…

Your 2 is not a signals drawback, but a SolidJS one. I love signals in VueJS, and it doesn’t even preclude a redux-like/lite state- management library like Pinia.

I would rather use the proper Vue term, reactive references/refs. Signals is such an awkward term.

https://vuejs.org/guide/extras/reactivity-in-depth.html#conn...

Re: What Are Signals?

#48
post #47

Earlier quoted context omitted.

Your 2 is not a signals drawback, but a SolidJS one. I love signals in VueJS, and it doesn’t even preclude a redux-like/lite state- management library like Pinia.

I would rather use the proper Vue term, reactive references/refs. Signals is such an awkward term. https://vuejs.org/guide/extras/reactivity-in-depth.html#conn...

That’s why I italicized it.

Re: What Are Signals?

#49
post #46
post #22

Earlier quoted context omitted.

Elm managed to move away from signals back in 2016 (controversial at the time, but IMO a great move). https://elm-lang.org/news/farewell-to-frp

Controversial only because they were hard to learn and those that invested in learning lost that investment. The new architecture is so much better and not hard to explain.

This one sentence probably explains 90%+ of all programming advocacy.

Re: What Are Signals?

#50
This does not differ from the logic that comes with React hooks. "We've added new magic for you. Everything is done in the background. You just code the way we want.". This logic generally results in new complexities eventually. Because I don't think there's any benefit in trying to hide the obvious complexity in this way.
Post reply on HN