3 ms·
It's a little bit of a stretch to call this "reactive": > The component re-renders itself automatically after calling an event handler, but you need to call th
by montroser 3y ago
It's a little bit of a stretch to call this "reactive":
> The component re-renders itself automatically after calling an event handler, but you need to call this manually if there is no clear interaction to be detected.
It is a creative approach to shed reactivity and just re-render after calling an event handler, and in some applications it can even be preferable to manage your own updates. But generally this seems like it will be rough and not enough in practice.
For very simple apps it might just work, but in rich interactive settings, it happens all the time that the whole point of interacting with one component is to affect the content in other components on the page. In those cases it can be a slog with this approach for the developer to have to manually keep track of which components need to be updated and traverse through and call update() in all the right places.
- nine_k 3y agoA truly reactive Preact [1] is merely 3 kb of JS. OTOH the need for really simple bits of interactivity does occur in real life. If the htmx [2] approach does not cu it, a micro-library like this could. [1]: https://preactjs.com/ https://preactjs.com/ [2]: https://htmx.org/ https://htmx.org/
- deleted 3y ago[deleted]