Our React apps can load as quickly as a vanilla HTML site! We can generate the initial HTML way ahead of time, on our development machines, and distribute it immediately when a user requests it. The galaxy-brain realization is that huge chunks of many websites and apps are static, and they can be built at compile-time. It's just that the work is being done on the server, not on the user's computer. When you request, React has to transform your React components into HTML, and you'll still be staring at a blank screen while you wait for it. Server-side rendering can be a performance win, but the thing is, that work still needs to be done on-demand. This is known as server-side rendering (SSR). That way, they'd have something to look at while the browser downloads, parses, and executes the JS. Smart people realized that if we could do that rendering on the server, we could send the user a fully-formed HTML document. This is known as client-side rendering, since all the rendering happens on the client (the user's browser).Īll of that stuff takes time, and while the browser and React are working their magic, the user is staring at a blank white screen. Once the browser downloads and parses those scripts, React will build up a picture of what the page should look like, and inject a bunch of DOM nodes to make it so. The page is fundamentally empty, but it includes a couple JS scripts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |