2 ms·
Say 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
by Yahivin 12y ago
Say 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.