remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
52.84k stars 10.23k forks source link

renderToString(<RoutingContext />) spits JSX and not HTML #2576

Closed neemzy closed 8 years ago

neemzy commented 8 years ago

I'm trying to render some React on the server side with PHP and the v8js extension. Taking inspiration from the docs, I used this:

renderToString(<RoutingContext {...renderProps} />)

Which actually spat JSX (which actually is the expected content), like it stopped halfway in the process of turning the original JSX into the final HTML:

<Root data-reactid=".1ub5mi2x4ow" data-react-checksum="-1581769077"><HomePage data-reactid=".1ub5mi2x4ow.0"></HomePage></Root>

Quite unsure this is directly related to react-router, but who knows? I successfully rendered React with v8js recently, and only encountered such an issue when I started mixing react-router in :)

I'll gladly give any other piece of info you may need. Best regards, and kudos on the amazing piece of work react-router is!

taion commented 8 years ago

Thanks for your question!

We want to make sure that the GitHub issue tracker remains the best place to track bug reports and feature requests that affect the development of React Router.

Questions like yours deserve a purpose-built Q&A forum. Would you like to post this question to Stack Overflow with the tag #react-router? https://stackoverflow.com/questions/ask?tags=react-router.

We also have an active and helpful React Router community on Reactiflux, which is a great place to get fast help with React Router and with the rest of the React ecosystem. You can join at https://discord.gg/0ZcbPKXt5bYaNQ46.

neemzy commented 8 years ago

Yup, sorry about that, it definitely wasn't related to the library. Thanks though!