Live data from Hacker News

How we switched our template rendering engine to React

engineering.pinterest.com

21–30 of 42 posts

Re: How we switched our template rendering engine to React

#21
Best web app I've developed was basically Django, with bare minimum JavaScript to handle some in-page effects. People been trying to shoehorn desktop concepts in the web since forever and it will never work. A desktop app is installable, a web site is not. It makes no sense to wait your js app to download for the sake of smooth page transitions.

Take a look at reddit's new mobile site, written in react. It takes around 7 seconds to load, to display text and links. Compare that to HN's, which loads in 0.1 sec, for basically the same content.

SPA's have their place, for things like games or the likes of google maps. But for the rest, please respect the web paradigm . Your site will be simpler to build, faster and most importantly, lighter. The web world has become mobile-first, not js-centric...

Re: How we switched our template rendering engine to React

#22
post #21

Best web app I've developed was basically Django, with bare minimum JavaScript to handle some in-page effects. People been trying to shoehorn desktop concepts in the web since forever and it will never work. A desktop app is installable, a web site is not. It makes no sense to wait your js app to download for the sake of smooth page transitions. Take a look at reddit's new mobile site, written in react. It takes arou…

[deleted]

Re: How we switched our template rendering engine to React

#23
post #3

Would have liked to have seen some figures or graphs visualising the React performance boost. Also I thought one of the advantages of using a js framework is that rendering can be done on the client? It sounds from this article that server rendering is more advantageous? Also SEO was mentioned, but I thought javascript was taken into consideration by web crawlers?

> but I thought javascript was taken into consideration by web crawlers?

It's still kind of crappy. So people end up building more complex solutions like this or using stuff like prerender.io to work around this issue. Just adds another layer of complexity to the already way to complicated stack of modern SPAs (in my opinion)

Re: How we switched our template rendering engine to React

#24
post #21

Best web app I've developed was basically Django, with bare minimum JavaScript to handle some in-page effects. People been trying to shoehorn desktop concepts in the web since forever and it will never work. A desktop app is installable, a web site is not. It makes no sense to wait your js app to download for the sake of smooth page transitions. Take a look at reddit's new mobile site, written in react. It takes arou…

You're betting against history.

Re: How we switched our template rendering engine to React

#25
I saw a presentation about REST and it included the concept of 'on demand code'; why do we need to serve up all our react components in a js blob? Can't we serve up minified and compressed components preemptively on the wire to keep load times small? Would this offer a benefit or am I missing something?

Re: How we switched our template rendering engine to React

#26

Earlier quoted context omitted.

> Also I thought one of the advantages of using a js framework is that rendering can be done on the client? It sounds from this article that server rendering is more advantageous? Server rendering has advantages when first loading the SPA from the server: better user experience - faster loading because you don't need to wait for AJAX calls to do their round trips between browser and server to get data to populate the…

Can't one populate the initial state from the server to skip the extra round trip of the ajax call? Eg. dump a json somewhere on the page and have react load it from there, like a global JS variable.

There's that, or use something like python-react[0]. No js on the server required ;)

[0] https://github.com/markfinger/python-react

Re: How we switched our template rendering engine to React

#27
post #21

Best web app I've developed was basically Django, with bare minimum JavaScript to handle some in-page effects. People been trying to shoehorn desktop concepts in the web since forever and it will never work. A desktop app is installable, a web site is not. It makes no sense to wait your js app to download for the sake of smooth page transitions. Take a look at reddit's new mobile site, written in react. It takes arou…

The web paradigm also supports accessibility for people with visual disabilites.

Re: How we switched our template rendering engine to React

#28

Earlier quoted context omitted.

> Also I thought one of the advantages of using a js framework is that rendering can be done on the client? It sounds from this article that server rendering is more advantageous? Server rendering has advantages when first loading the SPA from the server: better user experience - faster loading because you don't need to wait for AJAX calls to do their round trips between browser and server to get data to populate the…

Can't one populate the initial state from the server to skip the extra round trip of the ajax call? Eg. dump a json somewhere on the page and have react load it from there, like a global JS variable.

Yes, that's what's done but also you want the page to be server side rendered for SEO and may be for those who have js disabled.

Re: How we switched our template rendering engine to React

#29

Earlier quoted context omitted.

> Also I thought one of the advantages of using a js framework is that rendering can be done on the client? It sounds from this article that server rendering is more advantageous? Server rendering has advantages when first loading the SPA from the server: better user experience - faster loading because you don't need to wait for AJAX calls to do their round trips between browser and server to get data to populate the…

Can't one populate the initial state from the server to skip the extra round trip of the ajax call? Eg. dump a json somewhere on the page and have react load it from there, like a global JS variable.

I suspect that in most cases time spent loading the initial data is dwarfed by the initial app payload and turning the data into html.

Server-side rendering solves this by sending you a full 'screenshot' of the initial app, even before the app is downloaded and 'fresh' data is requested.

The clever thing React does in this use-case is that even though the initial load is 'finished' html, React won't have to re-render the entire thing once your app is loaded and requests new data. Instead, it will be able to seamlessly take over and update only what's new, and do its usual thing from there.

One issue you could run into is that users start trying to interact with your app before React has taken over. I'm not sure if that's a problem in practice though, perhaps others can chime in.

Re: How we switched our template rendering engine to React

#30
post #21

Best web app I've developed was basically Django, with bare minimum JavaScript to handle some in-page effects. People been trying to shoehorn desktop concepts in the web since forever and it will never work. A desktop app is installable, a web site is not. It makes no sense to wait your js app to download for the sake of smooth page transitions. Take a look at reddit's new mobile site, written in react. It takes arou…

I honestly feel the same. I've been working as a web developer for 8 years now, so it's not like I've been locked in a basement for decades and don't like all this new fangled stuff because it's not what I'm used to. I just don't get what SPAs provide over server rendered pages with a sprinkling of JavaScript to make things more interactive.

Ok maybe it makes sense if you are building a game. Or something that needs to run offline. Or Facebook. But most web sites aren't like that.

The other day there was a Ask HN about what stack a CMS should be built in. Most people were recommending their favourite client-side JavaScript framework. I just don't get it...

Post reply on HN