kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 192 forks source link

SSR : how to render react component using ssr #637

Open ansonla3 opened 8 years ago

ansonla3 commented 8 years ago

I have installed the flow-router-ssr, but do not know to make the react component could do the server side rending.

What I have done is so far. is having a react component in the server folder then import it in the client side routes.jsx, then use the react-mounter to mount it, but there is nothing show on the screen.

anyone could help ? Please help,

sahanDissanayake commented 8 years ago

Have a look at these samples

https://github.com/kadira-samples/meteor-data-and-react

On May 30, 2016, 5:47 AM, at 5:47 AM, ansonla3 notifications@github.com wrote:

I have installed the flow-router-ssr, but do not know to make the react component could do the server side rending.

What I have done is so far. is having a react component in the server folder then import it in the client side routes.jsx, then use the react-mounter to mount it, but there is nothing show on the screen.

anyone could help ? Please help,


You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kadirahq/flow-router/issues/637

ansonla3 commented 8 years ago

Yes, I read before,

this only in the container set the title, meta description. I want to render the whole react component in html format so that google could crawl the web page easily.

Do you have any ideas ? thanks very much .

sahanDissanayake commented 8 years ago

yep, the example link if gave you actually render the html on the server side. So google can crawl. Have you actually ran the code on your computer to see if it renders on the server or not ?

ansonla3 commented 8 years ago

ya , it works with that project.

but when use this project https://github.com/mantrajs/kickstart-mantrajs-webpack , remove the existing flow-router and install the flow-router-ss, it didn't work as expected. not sure what is the reason. Do you think that is related to webpack or mantrajs ? Can you help to have a try ?

Thanks very much.

oychao commented 8 years ago

I have the same question, have you fixed that.

lyquocnam commented 8 years ago

have you import routes from meteor server code ? webpack do not load files auto.

ex:

// both/routes.js
...
FlowRouter.route('/', {
    action() {
      mount(Layout);
   }
}
// server.js
import 'both/routes';