Equivalent of React.renderToString() function in Dart?

92 views
Skip to first unread message

try_dart

unread,
Feb 9, 2016, 6:01:53 AM2/9/16
to mi...@dartlang.org
Hi Devs! 

Thanks & hope you continue to do the great work you have been doing.

A version of our UI is in Dart, and it works great. But the problem is search engine crawlers. Google webmaster tools claim that they handle Javascript, and they do it quite well, I believe. But in practice it means slower page loads, including timeouts. This is mainly because of increased no. of requests, coupled with running the JS init()/start() code, then more calls to get data, and then the DOM gets created. 

Which makes it ineffective for use in SEO, and one is forced to fall back to another version of static HTML (also implies dated) for SEO.

Recently, I came to know about this trend of isomorphic web apps, which work great with all the latest/cool JS in the browser, as well as takes care of server side generation of HTML, which is achieved primarily by calling functions like for e.g. React.renderToString() on a given domElement, in React, . This way, it results in much faster page load as well. 

So the question is: Is there an equivalent of this function in Dart? If not, are there any plans to add it? IMHO, this may be a feature required by lot others, as well. 

Sincerely,

EDIT: typos

Günter Zöchbauer

unread,
Feb 9, 2016, 7:16:42 AM2/9/16
to Dart Misc
There is a react implementation for Dart that probably can do that as well.
The Dart team is also working on configurable imports and I guess this will lead to and alternative `dart:html` implementation that allows to run and render Dart client applications on the server without a browser.
Angular is also working on server side rendering and I assuem they will implement this for Angular Dart as well.

Another approach is to use Phantom.js to render the client application and create static snapshots.

Khushnood Naqvi

unread,
Feb 9, 2016, 8:12:02 AM2/9/16
to mi...@dartlang.org
Thanks for your reply. I saw that React- Dart. But I worry, that I will be stuck with something un-maintainable. Also won't have the benefit of dev/debug tools (React plugin for chrome). 

Good to know about configurable imports and a server side implementation of 'dart:html'. Any idea by which version it will be available? From the sound of it, looks to be a major version feature.

Phantom.js route looks cumbersome (managing static cache expiry; more movable pieces, deploy process etc)...perhaps easier to embed dart code compiled to JS, in the static pages somehow, which get served by a reliable server already. (Just thinking aloud, don't mean to be argumentative)

Thanks again, for your pointers.

--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to a topic in the Google Groups "Dart Misc" group.
To unsubscribe from this topic, visit https://groups.google.com/a/dartlang.org/d/topic/misc/DOsSi6TBpVE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to misc+uns...@dartlang.org.



--
Reply all
Reply to author
Forward
0 new messages