Last active
August 29, 2015 14:08
-
-
Save anthonyshort/58323ec2f20798884e97 to your computer and use it in GitHub Desktop.
vdom
This file contains hidden or 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
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 |
This file contains hidden or 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
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