react-router icon indicating copy to clipboard operation
react-router copied to clipboard

Capability for full page rendering (HEAD, META, etc)

Open geekyme opened this issue 11 years ago • 3 comments

Hello,

I have an isomorphic setup and I want to handle rendering different meta tags / title tags on different pages. Is there a way to do this with react-router?

Something like how react-router-component is doing with their full page rendering? http://strml.viewdocs.io/react-router-component/server-side

geekyme avatar Mar 09 '15 03:03 geekyme

Have you tried wrapping the Handler from the run callback: React.renderToString(<html><head>..</head><body><Handler /></body></html>);? As for assembling the meta data, you can make use of the state param. There's a related issue #927.

agundermann avatar Mar 09 '15 05:03 agundermann

See:

https://github.com/gaearon/react-side-effect https://github.com/gaearon/react-document-title/issues/5#issuecomment-78040599

These approaches solved my use cases. I haven't revisited it in awhile, but I imagine the move away from mixins, towards using context, will resolve what I ran into in #492 as well.

irvinebroque avatar Mar 11 '15 06:03 irvinebroque

not really related to the router, so I'm closing, great links :)

ryanflorence avatar Mar 25 '15 17:03 ryanflorence