Closed nelsonic closed 6 years ago
As soon as you attempt to change the model
everything will "break":
This is understandable! it's like trying to put a different/new fuel in your old car! it's won't run!
Showing multiple counters:
multiple instances:
Multiple counters using the same App:
It occurred to me while applying the Elm Architecture to my little "side project": https://github.com/nelsonic/time-mvp/issues/33 That there's a "gap" in this tutorial, namely: how do we have a more "complex"
model
(all the examples in the tutorial, currently havemodel
as anint
)I propose that we: write an "exercise for the reader" to: a) refactor the
model
in the "reset counter" example to use anObject
e.g:var model = { counters:[0] }
where the value of the first element in themodel.counters
Array is the value for the single counter example. b) using thevar model = { counters:[0] }
approach, display multiple counters on the same page. c) write tests for the scenario where there are multiple counters on the same page.