简体   繁体   English

我们应该在 react ssr 应用程序中同时构建客户端和服务器吗?

[英]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.

相关问题 构建和运行 React SSR 应用程序作为纯客户端应用程序 - Build and run a React SSR application as a pure client side application 我们可以在同一个反应应用程序上设置客户端和服务器端渲染吗? - Can we setup client and server side rendering on same react app? 服务器和客户端中的Node Js和React js SSR时间不匹配 - Node Js and React js SSR time in server and client is not matched React SSR:防止客户端呈现在服务器上呈现的组件 - React SSR: Prevent client side rendering of components which are rendered on the server 我们如何使用 React Router 4 将客户端渲染 React js 应用程序转换为服务器端渲染? - How we can convert client side rendering react js app to server side rendering using react router 4? 反应客户端和服务器端渲染 - React both client side and server side rendering 为什么我们需要运行一些服务器来运行客户端反应应用程序进行生产? - why do we need to have some server running to run client react app for production? React SSR Firebase应用程序中的图像 - Images in a React SSR Firebase App SSR 应用程序,但客户端的 React Router Navigation 无法获取数据并破坏页面 - SSR app but React Router Navigation on the client side doesn't fetch data and breaks the page 对 SSR 使用 react-router:客户端为每条路由向服务器发送一个新请求 - Use react-router for SSR: client sends a new request to server for every route
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM