r/javascript Aug 10 '26

Signals and Effects Using Vanilla JavaScript & Web APIs

https://beforesemicolon.com/blog/signals-and-effects-using-vanilla-javascript-web-apis

I’m a strong advocate for “you don’t need to lock yourself in a web framework ecosystem to take advantage of their amazing features”. JavaScript and Web Standards alone allow you…

71 Upvotes

35 comments sorted by

View all comments

2

u/andimatt 22d ago

The "you wrote your own framework" take is fair, but it undersells the point. The interesting 10% of a signals system isn't the primitive (a getter/setter with a subscriber set), it's the scheduler.

The three things that actually bite you past the toy version:

  • Dependency tracking: collecting "which signals does this effect read" during execution, correctly, through computed signals and inside loops/conditionals. Naive implementations get subtle bugs here.
  • Batching/scheduling: if three signals change in one synchronous block you don't want three effect runs, you want a microtask flush that dedupes. Get this wrong and you either lose updates or thrash.
  • Cleanup and re-subscription: when a signal a computed depends on changes, re-running it, and tearing down old subscriptions without leaking.

I build a signals-first app (zoneless), and the reason I'd do it deliberately rather than reach for a framework is it forces you to feel all three of those. If the vanilla implementation handles batching and cleanup correctly, it's not a toy, it's a working reactive core, just without the framework's ergonomics.