Does the node server-side rendering of the front-end framework mean that the framework is initialized on the server side and the data is rendered directly to the browser for display? If that's the case, I'm thinking, if the front-end framework is initialized on the back-end, then don't the method variables and memory initialized by the framework stay in the server node environment? I'm very confused!
The backend only renders the template and returns the initial html file, which makes access faster, but adding methods and other things is still done by the frontend, by referencing script tags, etc.
Basically run it twice and control it with the life cycle function of
redux
来说,redux
是支持传入初始状态,在后端将store
生成,然后作为一个属性挂载到window
上面,这个基本上会利用模板,例如ejs
。对于react
的技术栈来说,可以关注一下我写的一个脚手架,支持服务端渲染,里面有服务端渲染的实现。服务端渲染有可能造成的是前端跑一次后端跑一次,进行两次数据获取过程,需要利用react
.