Best FlowRouter + React subscription pattern?


I’m trying to follow “best practices” for React/FlowRouter and handle my subscriptions in my components:

For example:

<Post postId="idstring" />
<Post postId="idstring" />

Then in my getMeteorData() function I subscribe to the post:

getMeteorData() {
    var handle = Meteor.subscribe('postById',;
    if(handle.ready()) {
        return {
            post: Posts.findOne({_id:}),

This seems the most correct way to do this, because all the handling is contained within the component, and it can be used everywhere without needing any external data. But it is slow when rendering large lists (1000 items) because this results in 1000 subscriptions.

A faster way would be to subscribe to all posts in <List> and pass the post object to each <Post> but this does not seem the cleanest way to do this.

What would be the correct way of doing something like this? I’m moving to fetching the data in <List> and using meteorhacks:subs-manager for now, but it doesn’t feel 100% right.

I think in react, create a container component to compose data for child components is better than get data in each components.

You can take a look at

1 Like

Subscribe to your posts in an outer container, and pass each individual post to individual post-components using a map function. This is described in a lot of React tutorials, and uses Reacts own patterns for one-way data bindings. Look [here] ( - it’s described in the “dynamic children” section.

1 Like

Thanks, seem like I was wrong :smile: Couldn’t get flowrouter-ssr to work with this approach … but since it adds a lot to the initial loading time I’m not using it right now.