课程: Learning Full-Stack JavaScript Development: MongoDB, Node, and React

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Server-side rendering of the root path

Server-side rendering of the root path

- [Instructor] The application is now rendering data from the API server with JavaScript. But what happens if we don't have JavaScript? We can actually disable JavaScript here in Chrome Dev tools down in the settings, there is a disable JavaScript option and if we test with JavaScript disabled the application is empty. The only thing that it renders is the original content that we rendered in the EJS template. This is what most search engines see if they request the application. Ideally, we want the application to render from the server as seen by React so that we get the benefits of search engine optimizations and also we get a little bit of performance benefit. Instead of waiting for React to warm up, render the component and then go back to the server to fetch the data, we can have an initial view ready by the server. So to do that let's go to server.ts and what we need is to modify this instead of a loading message,…

内容