Hey Bryan.
Here’s a fork of your sketch that implements the pattern Mike described above — avoiding the circularity in the definitions:
Now, the values (p, n, a …) are the single sources of truth, and the views are mutated directly by the increment and decrement buttons.
You’ll notice two new helper functions: update
, and incdec
, to DRY up the code a bit for mutating the slider views.
Let me know if anything in there isn’t making sense.
Cheers,
Jeremy