News for hackers. Stuff that matters.
Re:A proposal to add signals to JavaScript by troupo on Monday April 01, 2024 @11:50AM (#39895482)
Note how much work you need to do manually:

- don't forget to trigger a render from a getter. Possibly not just from one getter if the component relies on more than one data point that is changing

- don't forget to fire a custom event if this data needs to be propagated somewhere else

- don't forget to subscribe to the custom event in the places where this data is needed and trigger the render when the data is updated

- (good programming practice: ) don't forget to unsubscribe from those custom events because memory leaks

I'm not saying it's impossible to do, or that people haven't been doing this, successfully, for years across many projects. What you can have though is that same thing happening automatically: when a reactive value gets updated, all the places where it's used get updated. As frameworks/libraries with fine-grained reactivity will show you, literally only those places will get updated. E.g., you won't need to re-run a full re-render on an entire component just because some piece of data got changed.

Re:A proposal to add signals to JavaScript by claytongulick on Monday April 08, 2024 @06:19PM (#39974336)
> Note how much work you need to do manually

In practice, I find the totality to be less work and easier, otherwise I'd use a framework.

> As frameworks/libraries with fine-grained reactivity will show you, literally only those places will get updated

Maybe take a look at how lit-html works.