Closed tgoldenberg closed 9 years ago
Something like this should work:
TemplateRenderer = React.createClass({
componentDidMount: function() {
var templateContainer = this.refs.templateContainer.getDOMNode();
var template = Template[this.props.templateName];
this.rendered = Blaze.render(template, templateContainer);
},
componentWillUnmount: function() {
Blaze.remove(this.rendered);
},
render: function() {
return <div ref="templateContainer" />;
},
});
// Some other component
YourComponent = React.createClass({
render: function() {
return <div>blah blah... <TemplateRenderer templateName="shareit" /></div>;
},
});
Wow, I'll try it out. Thanks!
So far I have been using React components as basically children of Meteor templates by using this project. However, what about the opposite? For example, how would I have a special Meteor template helper be a child of a React component, like {{> loginButtons }? I say this because I am looking for a good social share package, but it works through a built-in template helpers, {{> shareit }. In that case, what is my best option? Thanks!