Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render DOM on the serverside #2

Open
arianvp opened this issue Jul 16, 2014 · 2 comments
Open

Render DOM on the serverside #2

arianvp opened this issue Jul 16, 2014 · 2 comments

Comments

@arianvp
Copy link

arianvp commented Jul 16, 2014

When you use React.renderComponentToString(component) in React you can prerender the DOM to html in such way that you can send the pre-rendered HTML to the client and then 'hook' to the pre-rendered DOM as if it was generated on the client itself.

You can even take this a step further with the ReactAsync package and do stuff like XHR on the serverside aswell and prerender those elements that depend on asynchronously loaded content into the DOM.

Example: https://github.com/andreypopp/react-quickstart

I was wondering if something like this would be worth exploring in shade. It would be extremely cool.

@takeoutweight
Copy link
Owner

You are right, this is a great feature of React and I'm definitely planning on taking a crack at it! One of the advantages of the tagless-final style is you can re-interpret the same expressions in different contexts-- I'm planning on making a "server side" context that takes your views and generates static content (possibly via blaze-html etc).

I didn't know about ReactAsync though. that's a cool idea and definitely worth looking into.

@L8D
Copy link

L8D commented Nov 3, 2014

My two cents:

ReactAsync is intended for the cases where it is extremely necessary to perform async state generation, and as the disclaimer says in the README, it is not something you should build apps off of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants