React + packages using Blaze templates coexisting


#1

I’m playing with converting an app that uses react-meteor (https://github.com/reactjs/react-meteor) to using the new React integration described in http://react-in-meteor.readthedocs.org/.

In my app, all “my” code uses only React components, but I am also using mrt:accounts-admin-ui-bootstrap-3 so that I don’t have to roll my own basic user management. This is implemented using Blaze.

I’m using iron:router for routing and currently I have a route like:

Router.route('/admin/users', function () {
    this.render('navbar', {to: 'navbar'});
    this.render('adminUsers');
});

With react-meteor, top level components register a kind of fake Blaze template that can then be referenced in an iron:router this.render() call.

The new React integration doesn’t have this (which is probably good, it’s a bit of a hack). As far as I can tell that also means that using iron:router is out, since it is based on the idea of rendering a Blaze template into a region.

That’s fine for my own code - I can just use react-router and keep everything in React, but I really want to be able to “mount” the mrt:accounts-admin-ui-bootstrap-3 UI on a URL like /users.

It’s hard to see how this would work. One option may be to create a React component that render a Blaze template in componentDidMount(), though that seems kind of hacky as well.

Any thoughts?


#2

Package meteor-routecore have a lib to convert Blaze template to React component.

var LoginButtons = BlazeComponent('loginButtons');

React.render(<LoginButtons />, document.body);

You can try!!! :stuck_out_tongue: