dwyl / learn-elm-architecture-in-javascript

:unicorn: Learn how to build web apps using the Elm Architecture in "vanilla" JavaScript (step-by-step TDD tutorial)!
https://todomvc-app.herokuapp.com
GNU General Public License v2.0
213 stars 19 forks source link

Elm(ish) onClick Event/Function Attribute #58

Closed nelsonic closed 6 years ago

nelsonic commented 6 years ago

In order to simplify event listeners in our TEA example apps, I'm thinking that adding an onclick attribute to a given node and passing in the signal(action) is the simplest way of keeping the view declarative.

This will be useful for both "delete" a todo item (which is a button) and incrementing a counter.

nelsonic commented 6 years ago

image

Code: https://github.com/dwyl/learn-elm-architecture-in-javascript/pull/45/files#diff-61a1967a8f2230abdebea6572ec20c82R65 #OneLiner 😉