React + React Router + Templates?


#1

Hi,

I am trying to build a webapp with React and React Router. I have the basics down on how to get the router working and now I want to include the Accounts package. How do I include the {{> loginButtons}} template in my React render?

Below are my example routes and Login Component, which obviously is incorrect.

Routes = React.createClass({
  getInitialState: function() {
    return {};
  },
  render: function () {
    return (
      <Router history={ReactRouter.lib.BrowserHistory.history}>
        <Route path="/login" component={Login}/>
        <Route path="/signup" component={Signup}/>
        <Route component={App}>
          <Route path="/" component={Dashboard}/>
          <Route path="items" component={Items}/>
        </Route>
      </Router>
    );
  }
});

Login = React.createClass({
  render: () => {
    return (
        <div>
            // how to include templates in React render function???
           {{> loginButtons}} 
         </div>
        )
      }
    });

#2

I just had the exact same problem yesterday, solved it here:

Plus, you get to pass params to your blaze templates for free if you use my code too :smile:


#3

Awesome, thanks! I will give this a shot.