Last active
April 11, 2017 06:16
-
-
Save tivac/c00c04833e0883e658ef659da44ea469 to your computer and use it in GitHub Desktop.
Mithril Component Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var root = document.body | |
var count = 0 // added a variable | |
var Hello = { | |
view: function() { | |
return m("main", [ | |
m("h1", { | |
class: "title" | |
}, "My first app"), | |
// changed the next line | |
m("button", { | |
onclick: function() {count++} | |
}, count + " clicks") | |
]) | |
} | |
} | |
m.mount(root, Hello) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/mithril"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment