search

Home  >  Q&A  >  body text

Confusion with node server-side rendering - Stack Overflow

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!

为情所困为情所困2738 days ago496

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-16 13:38:28

    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.

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:38:28

    Basically run it twice and control it with the life cycle function of redux来说,redux是支持传入初始状态,在后端将store生成,然后作为一个属性挂载到window上面,这个基本上会利用模板,例如ejs。对于react的技术栈来说,可以关注一下我写的一个脚手架,支持服务端渲染,里面有服务端渲染的实现。服务端渲染有可能造成的是前端跑一次后端跑一次,进行两次数据获取过程,需要利用react.

    reply
    0
  • Cancelreply