Fast-Render + React #29

Closed
ccorcos opened this Issue Mar 9, 2015 · 7 comments

Projects

None yet

3 participants

@ccorcos
Contributor
ccorcos commented Mar 9, 2015

Hey there, I've been playing around with React lately and I've been using flow-router instead of iron-router because its way less opinionated (about blaze, particularly).

Anyways, I'm curious how I could get server-side rendering working. React has this method React.renderToString that should make it easy for SSR. This is clearly incomplete, but here's the idea:

https://github.com/ccorcos/meteor-react/blob/master/examples/SSR/main.jsx

I was looking around the fast-render code, and it looks like it relies on (1) subscriptions through flow-router, and (2) Meteor.subscribe. I'd like to use a React mixin to do subscriptions from within the React classes and I'd also like to use subs-manager.

Any suggestions on where/how to get started with this?

Thanks

@arunoda
Contributor
arunoda commented Mar 9, 2015

This is very interesting question and I've no direct answer for this right now.
There is a way we can do this within the flow-router layer.

For that we need to run .action method on the server side. Then we need to create a custom context for Mongo Collections with the data for from subscriptions.

Then we need to rely on fast-render on locally. Otherwise, after the initial load there'll be no data on the client. So, that'll re-render UI with no data.


So, here only advantage is SEO support. Otherwise this is just the same as using pure fast-render.

In order to get the benefit of pure SSR support, we need to add a way to put blocking css and JS separately in the head. Then the HTML.(with SSR). After that, load other JS stuff.

This involves a lot of core changes and it's worth doing that. I can work on these, but I've a lot of stuff on the plate right now :D

@ccorcos
Contributor
ccorcos commented Mar 9, 2015

whoa. I was just thinking for SEO. This sounds very involved though. I guess I will just sit eagerly waiting ;)

@arunoda
Contributor
arunoda commented Mar 9, 2015

If that's SEO. I think we'll be fine without SSR pretty soon.
Google can see pages:
https://meteorhacks.com/meteor-seo-google-fetch-and-render.html

On Mon, Mar 9, 2015 at 2:10 PM Chet Corcos notifications@github.com wrote:

whoa. I was just thinking for SEO. This sounds very involved though. I
guess I will just sit eagerly waiting ;)


Reply to this email directly or view it on GitHub
#29 (comment)
.

@ccorcos
Contributor
ccorcos commented Mar 9, 2015

Hmm. So what would I have to do to be able to cURL my website?

@arunoda
Contributor
arunoda commented Mar 28, 2015

Hope we can close this.

@arunoda arunoda closed this Mar 28, 2015
@trusktr
trusktr commented Apr 2, 2015

@arunoda I'm very interested in this too, as might also be people discussing in meteor/meteor#3728 (you are there!).

What's the difference between what fast-render does and pure SSR?

Also, check out meteor-routecore, which implements pure SSR of React views in Meteor. Maybe you can get some ideas from there?

@arunoda
Contributor
arunoda commented Apr 2, 2015

Yeah! I know route core from back then. They are using fast-render as well.
We need to wait until GraphQL and Relay to get released. They might changed
how we do things.
It might make things simple.

On Thu, Apr 2, 2015 at 10:30 AM Joseph Orbegoso Pea <
notifications@github.com> wrote:

@arunoda https://github.com/arunoda I'm very interested in this too, as
might also be people discussing in meteor/meteor#3728
meteor/meteor#3728 (you are there!).

What's the difference between what fast-render does and pure SSR?

Also, check out meteor-routecore
https://github.com/mystor/meteor-routecore, which implements pure SSR
of React views in Meteor. Maybe you can get some ideas from there?


Reply to this email directly or view it on GitHub
#29 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment