[英]Should we build both client and server in react ssr app?
When creating a React SSR app from scratch using webpack, should you be building the client and server both or just the client.使用 webpack 从头开始创建 React SSR 应用程序时,您应该同时构建客户端和服务器,还是只构建客户端。 Which one is preferred more than the other?
哪一个比另一个更受欢迎?
As I know, you can build just the server to use react server side rendering, when you hit the URL on the browser, it will make a request to your server and your server will create HTML,CSS and return the response to show on the page.据我所知,您可以仅构建服务器以使用反应服务器端渲染,当您在浏览器上点击 URL 时,它将向您的服务器发出请求,您的服务器将创建 HTML,Z2C56C3605804208DDF2页。
It is the old way to do server side rendering, and it has many disadvantages, what makes SPA (Single Page App) more and more common nowaday.它是做服务器端渲染的老方法,它有很多缺点,这使得 SPA(单页应用程序)现在越来越普遍。
But we have some modern way (like Next.js
) does.但我们有一些现代方式(如
Next.js
)。 But, implement this way, you have to implement both.但是,以这种方式实施,您必须同时实施。
For more detail of next.js, see on this page .有关 next.js 的更多详细信息,请参阅此页。
IMO, use next.js
for server side rendering is much easier for you to build something. IMO,使用
next.js
进行服务器端渲染更容易让您构建一些东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.