Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Counters on the Same Page 😮 #40

Closed
nelsonic opened this issue Jun 10, 2018 · 4 comments
Closed

Multiple Counters on the Same Page 😮 #40

nelsonic opened this issue Jun 10, 2018 · 4 comments

Comments

@nelsonic
Copy link
Member

It occurred to me while applying the Elm Architecture to my little "side project": dwyl/time-mvp-node#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 have model as an int)

I propose that we: write an "exercise for the reader" to:
a) refactor the model in the "reset counter" example to use an Object
e.g: var model = { counters:[0] }
where the value of the first element in the model.counters Array
is the value for the single counter example.
b) using the var 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.

@nelsonic
Copy link
Member Author

As soon as you attempt to change the model everything will "break":
image

This is understandable! it's like trying to put a different/new fuel in your old car! it's won't run!

@nelsonic
Copy link
Member Author

Showing multiple counters:
image

@nelsonic
Copy link
Member Author

multiple instances:
elm-arch-multiple-counters-naive

@nelsonic
Copy link
Member Author

Multiple counters using the same App:
image

nelsonic added a commit that referenced this issue Jun 16, 2018
…nters-instances/index.html instead of duplicating code! for #40
nelsonic added a commit that referenced this issue Jun 16, 2018
…nters-instances/index.html instead of duplicating code! for #40
@nelsonic nelsonic removed their assignment Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant