Adding SSR/react-helmet to existing site with react-intl and react-router


#1

I have an app using react-intl and I am working on adding head tags and then SSR. This is the first time I’ve done this on a Meteor project. It seems to make sense to handle both of these together from the looks of the available solutions.

https://atmospherejs.com/reactrouter/react-router-ssr looks interesting but I can’t figure out how I would integrate it with react-intl because react-intl asks you to wrap the <Router /> element in a <IntlProvider /> element but ReactRouterSSR creates the router element itself.

So if anyone has suggestions on either of these two methods it would probably solve my problem:

  1. Integrate react-intl with react-router-ssr
  2. Manually set up some of the components of react-router-ssr (react-helmet, etc) using npm packages directly

#2

I am using galaxy for hosting if that’s relevant.


#3

Hi! Did you figure it out? I have the same setup, but in addition I also use SubsManager which is not compatible with react-router-ssr.

Also how are you handling polyfill for Intl on the client? The recommended way is to use CDN, so I’ve used meteorhacks:inject-initial to get it there before the code executes (otherwise it would not work due to the <IntlProvider> element in the router).


#4

@storyteller: I haven’t figured out that main question yet. I’ll post back here when I do.

I posted my code for the polyfill in this thread: How to use TAPi18n within a Meteor + React application? at the bottom of the client/main.js file. I can’t find the tutorial that I followed but I picked that code up from somewhere.