Netflix functions without client-side React, and it's a good thing
jakearchibald.com
jakearchibald.com
* Write your app as React views
* As much as possible, render either the app skeleton or the full view on server
* Serve rendered HTML with async/deferred JS tags https://reactjs.org/docs/react-dom-server.html
* Optionally hydrate the HTML with React whenever the JS is done loading. https://reactjs.org/docs/react-dom.html#hydrate
* If the current page is a static page and doesn't need JS, don't even bother loading any JS. Just use https://reactjs.org/docs/react-dom-server.html#rendertostati... to begin with.
If you are signed in, then you will not see Netflix landing page and go straight to their app which has React.
I feel people are misunderstanding what Netflix meant in their tweet.
>> Netflix uses React on the client and server, but they identified that the client-side portion wasn't needed for the first interaction, so they leaned on what the browser can already do, and deferred client-side React. The story isn't that they're abandoning React, it's that they're able to defer it on the client until it's was needed. React folks should be championing this as a feature.
The initial page load doesn't use React. It doesn't need it. Its a pretty simple page with a bunch of links and a couple of signup/signin buttons. Once you click one of these links, the subsequent pages load React in order to handle the richer client-side interactions on those pages.
Seems reasonable. React allows for a better User Experience than static pages, but at the cost of additional load time. So don't load it on the first page, when your users are most likely to bail, and then load it once you need it.
Maybe we're starting to see the pendulum swing back the other way. 3 or 4 years ago, we seemed to go from 'SPA Nowhere' to 'SPA Everywhere,' and now maybe we're settling on 'SPA Where We Need It'
IMHO I find that many people on HN continuously seek for an excuse to not ship that product or that particular feature that caused them so many hours of frustration. I know the feeling. I have this feeling constantly because making software is hard! Some of our internal modules took me months to develop and get them right. Regardless of the language, regardless of the platform there always will be tradeoffs.
Let's not panic when companies like Netflix decide to remove React from their landing page. They have their own problems and they are certainly not my problems. Frankly, I consume Netflix on my TV so I do not care how their web page loads.
In terms of React, it has been a godsend for my business and if I have to I will pay for it. React is not the kind of thing you want to put in a simple application or to build a simple widget. React is useful when you build complex, state-aware applications in web technologies or mobile. Although I will choose to use React if I need to build the UI of Netflix, it is true that given that the UI is rather simplistic, it can be done better in a bit of javascript and CSS.
I have also looked into other technologies that are advertised as React alternatives such as Vue.js. My personal experience is that they do not even come close. They may have similar features but there are certain things in React and JSX that are just better and straightforward. Some of the applications we are currently working on (not public yet) are so complex internally that I cannot even begin to contemplate re-implementing them in anything else. The productivity gain will be negative in my opinion. We are constantly looking for alternatives but React for me is the best that fits my problem domain.
I hope this comment is helpful.
Let me fix the title for you:
"Netflix renders their landing page on the server. Preloads other code while you're signing in."
Revolutionary.
> A few days ago Netflix tweeted that they'd removed client-side React.js from their landing page and they saw a 50% performance improvement.
Are you telling me that serving a small, cached HTML page takes less time than downloading and running a full-fledged SPA? Gee whiz mister!
> It caused a bit of a stir.
Nope, but it gave people a good laugh.
> the headline boils down to: less code was executed and stuff got faster.
You bet.
Building inefficient systems is attractive when you externalize all that inefficiency onto other people.