Skip to content

Instantly share code, notes, and snippets.

@imalberto
Last active September 15, 2016 09:06
Show Gist options
  • Save imalberto/8286765 to your computer and use it in GitHub Desktop.
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.
// 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;
}
});
@ErhanAbi
Copy link

Is this a working example of react view injected in YAF? Shouldn't you replace entirely the Y.View module with React?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment