Does anyone know how did Netflix did the home page by server rendering and other page using reactjs. I want to know how did they do it. Sometimes it takes long time for react to load
You basically tell your server, when we get to this route, load this simple HTML template instead of that React wrapped one. It depends on their stack, but since they use Node, at the most basic level it'd be an Express/Koa based function that handles the routing.
It was so easy for Netflix since their frontpage didn't feature any functionality that really required React, like a user dashboard. You click to go to another page to login or signup, and thus starts the React.
The real challenge wasn't printing the HTML instead of React (that's easy), it was converting some vital React-based scripts to vanilla JS (which they discuss in the video above).
Ryosuke
Designer / Developer / Influencer
You can see their talk on it here, starts at like 11:30:
You basically tell your server, when we get to this route, load this simple HTML template instead of that React wrapped one. It depends on their stack, but since they use Node, at the most basic level it'd be an Express/Koa based function that handles the routing.
It was so easy for Netflix since their frontpage didn't feature any functionality that really required React, like a user dashboard. You click to go to another page to login or signup, and thus starts the React.
The real challenge wasn't printing the HTML instead of React (that's easy), it was converting some vital React-based scripts to vanilla JS (which they discuss in the video above).
Hope that helped! ๐