Hacker News new | ask | show | jobs
by halflife 16 days ago
Maybe push pull wasn’t the best metaphor, but the point is that everything can be reactive, it only depends on how much boilerplate you need to write to achieve the desired result.

Since react doesn’t have a true reactive model, you need to subscribe to changes manually (use effect) to create computations, while in signals it’s a primitive (computed).

I actually created a lib that operates signals over reacts state management (https://roypeled.github.io/react-logic/), so I removed the boilerplate to create a true reactive system.

If you want, you can create reactive system just from JS primitives, using callbacks. But that doesn’t make JS reactive by nature.

1 comments

> you need to subscribe to changes manually (use effect) to create computations

How do you mean? Since the render function reruns during every update to state/props, derived/computed values can be calculated from the updated state/props during rendering.

When all you need is a synchronous operations, yes. When it involves async, batching, buffering, and user input, it becomes much more complicated, and every step needs to be setup manually.