4 ms·
What's wrong with just using jQuery? what's the rational for using a reactive solution?
by notastartup 12y ago
What's wrong with just using jQuery? what's the rational for using a reactive solution?
- Yahivin 12y agoSay you're building a color picker with three text fields for R, G, B, and a swatch that displays the resulting color. You could do it in jQuery, but plumbing all the update code for each input would be kind of a chore. If you get a new source of input (say from the network) you'd have to remember to resync everything. To keep it simple you'd probably have to respond to `something changed` -> `update everything`. Reactive templates would only update the elements dependent on that change. With a reactive solution you make a model that contains observable RGB values and a function to compute the final color. Once you bind that model to your view everything stays in sync like magic.