Skip to content

Instantly share code, notes, and snippets.

@anthonyshort
Last active August 29, 2015 14:08
Show Gist options
  • Save anthonyshort/58323ec2f20798884e97 to your computer and use it in GitHub Desktop.
Save anthonyshort/58323ec2f20798884e97 to your computer and use it in GitHub Desktop.
vdom
import Component from "tron";
class MyThing extends Component {
initialState(){
return { open: false }
}
mounted(parent, el) {
console.log("omg I'm in the dom")
}
onClick(event) {
this.state.open = true
}
render() {
return this.dom('div', {onClick: onClick}), [this.props.text])
}
}
export default MyThing
function render(props, state, dom){
function onClick() {}
return dom('div', {onClick: onClick}), [props.text];
}
var MyThing = component(render)
.prop('text');
MyThing.prototype.mount = function(parent, el) {
console.log("omg I'm in the dom");
}
module.exports = MyThing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment