Opinion sought: react-meteor-data and react-redux

On a first-time Meteor project and want to use React for my view layer. I’m pretty familiar with Redux and creating React containers with them and am seeing a very similar pattern using react-meteor-data. My question is if I want to maintain a client-side only global store object for UI state using Redux, what’s the best way to create React containers that receive both Meteor data and the Redux store?

The pattern I’ve come up with is as follows – assume a ‘campaigns’ collection:

  • CampaignsDataContainer

    • subscribes to ‘campaigns’ and exports this.props.campaigns
    • outputs a CampaignsUIContainer and passes the campaigns props
  • CampaignsUIContainer

    • connects with react-redux for UI state data
    • outputs dumb components, passing meteor data and UI data/dispatches as needed

Does this make sense, are there any performance concerns, or is there a way to combine the containers, or some library out there that has a better solution?

1 Like

Using multiple containers is fine! I think that’s a great option.

1 Like

I have made the choice to put every data (ui state && db data) in the redux store. So i only use react-redux to connect both. So far, so good !

@vjau Thanks - but doesn’t that circumvent the “magic” Meteor reactive stuff?

I currently use meteor subscriptions which i bind to my redux store using @SkinnyGeek1010 code https://github.com/AdamBrodzinski/meteor-flux-helpers

1 Like