Skip to content

Instantly share code, notes, and snippets.

@tyv
Created January 22, 2015 21:59
Show Gist options
  • Save tyv/4af5b5ca09c8076b5742 to your computer and use it in GitHub Desktop.
Save tyv/4af5b5ca09c8076b5742 to your computer and use it in GitHub Desktop.
parent data access with riot
<myparent>
<div>{ list[2] ? list[2].e : list[0].a }</div>
<mychild list={ list }></mychild>
this.list = [{ a: 'b' }, { c: 'd' }];
</myparent>
<mychild>
// any HTML here
var parent = this.parent;
this.someHandler = function() {
opts.list.push({ e: 'f' });
parent.update(); // HOW TO AVOID THIS?
}
</mychild>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment