I have built a little Facebook-esque feed using Meteor and Blaze and IronRouter.
I’ve been looking into React and everything makes sense to me, it allows my components logic to be in one place and make it easy to grok.
Howver I’m having trouble mixing React with how layouts work. For example, I render a different layout when a user is signed out:
Router.configure({
layoutTemplate: 'layout'
});
Router.route('/', { name: 'home' });
Router.route('/profile', { name: 'profile' });
// This is the route for anonymous users.
Router.route('/welcome', { name: 'welcome', layoutTemplate: 'welcomeLayout' });
Router.onBeforeAction(function() {
if (!Meteor.userId()) {
this.redirect('/welcome');
this.next();
} else {
this.next();
}
});
I guess I’m just asking, am I supposed to render React components within Blaze templates? Is that the proper way to do it? Since I’m new to both Meteor and React, I’d learn things the right way instead of hacking my way towards a working site.