FlowRouter + React


#1

When using FlowRouter with React, do you need to use react-layout or react-mounter?

Theres quite a bit of conflicting info on which is suppose to be used and different tutorials are using different things. Which is it?


Flow Router is dead. Long live Flow Router
#2

You don’t need to. But you can if you feel it makes your life easier. In our internal apps we use FlowRouter with React, but without react-layout etc.


#3

React-mounter was made to remove the dependency on the React meteor package (no longer an issue)

Since things are heading towards npm, use react-mounter


#4

You don’t really need it either. You can just call React.render directly from the route.


#5

Mind Blown


#6

React Mounter. Flow router is used with react mounter,


#7

So what would that look like?

With react-mounter, apparently you do something like:

mount(MainLayout, {
  content: <MyComponent />
});

and place {content} where you’d like it to render.

How do you do that with just React.render()?


#8

You can do something like:

ReactDOM.render((
  <Layout>
    <MyComponent />
  </Layout>
), document.getElementById('app'));

And Layout can just be:

<div>
  {this.props.children}
</div>