Open jschlieber opened 8 years ago
+1
+1
+1
+1
For now I'm using this workaround:
const helmetToFlow = () => {
if (Meteor.isServer) {
const head = ReactHelmet.rewind();
const headContent =
head.title +
head.base +
head.meta +
head.link +
head.script;
const context = FlowRouter.ssrContext.get();
context.addToHead(headContent);
}
}
And call this function in every route action (after mount), like so:
FlowRouter.route('/', {
name: 'home',
action(params, query) {
const pathname = FlowRouter.getRouteName();
mount(Root, {
content: <Home title="Home" location={{pathname, params, query}} />
});
helmetToFlow();
}
});
I have a question! What's the mount Root for ?
2016-06-23 1:08 GMT+08:00 John Grishin notifications@github.com:
For now I'm using this workaround:
const helmetToFlow = () => { if (Meteor.isServer) { const head = ReactHelmet.rewind(); const headContent = head.title + head.base + head.meta + head.link + head.script;
const context = FlowRouter.ssrContext.get(); context.addToHead(headContent);
} }
And call this function in every route action (after mount), like so:
FlowRouter.route('/', { name: 'home', action(params, query) { const pathname = FlowRouter.getRouteName();
mount(Root, { content: <Home title="Home" location={{pathname, params, query}} /> }); helmetToFlow();
} });
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kadirahq/flow-router/issues/605#issuecomment-227811583, or mute the thread https://github.com/notifications/unsubscribe/AAh1WV9xDdEOzwQeLfDdJWk3s5kwkI81ks5qOWwAgaJpZM4INaKF .
@txs https://github.com/kadirahq/react-mounter used to mount react Root component into DOM on client and renders to string on server.
Currently using React Helmet with Flow Router SSR has no effect on the server side rendered document head. Supporting React Helmet as an alternative to Meteor DocHead would be great. What do you think?