Last active
September 15, 2016 09:06
-
-
Save imalberto/8286765 to your computer and use it in GitHub Desktop.
YAF and React.js Discussion context is getting YAF to use React.js effectively.
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
// YAF view | |
var PhotoView = Y.Base.create('photoView', Y.View, [], { | |
photoTemplate: Template.get('photonews/photo'), | |
render: function () { | |
var container = this.get('container'), | |
locals = this.get('locals'), | |
html; | |
html = this.photoTemplate({ | |
photo: locals.photo | |
}); | |
// In react.js | |
// var Component = React.createClass(....); | |
// React.renderComponent(<Component/>, document.getElementById('mycontainer')); | |
if (html) { | |
container.setHTML(html); | |
} | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this a working example of react view injected in YAF? Shouldn't you replace entirely the Y.View module with React?