Skip to content

Instantly share code, notes, and snippets.

@shrunyan
Last active October 21, 2015 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shrunyan/d9b0bd5ee0ac0b4ce344 to your computer and use it in GitHub Desktop.
Save shrunyan/d9b0bd5ee0ac0b4ce344 to your computer and use it in GitHub Desktop.
Example of riot todo MVC
<todo>
<h3>TODO</h3>
<ul>
<li each={ item, i in items }>{ item }</li>
</ul>
<form onsubmit={ handleSubmit }>
<input type="text" />
<button>Add #{ items.length + 1 }</button>
</form>
this.items = []
handleSubmit(e) {
var input = e.target[0]
this.items.push(input.value)
input.value = ''
}
</todo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment