<> What is server-side rendering ?
Simple understanding can be ： Front and rear end not separated ,
advantage ： Good page performance , advantageous to seo,
shortcoming ： Front and rear end not separated , Difficult data maintenance
<> What is front-end rendering ?
Front end rendering is to take advantage of ajax Get back-end data , Front end page structure detached from server , No server return required HTML,css,js etc .
advantage ： Clear structure , attend to each one 's own duties
shortcoming ,： Page load speed depends on JS Loading speed of （ Comparison with server-side rendering ）
<>node Isomorphic direct out rendering scheme ：
Famous Node, It's also JS. Current backend uses js write , Data can be realized , assembly , There are also some methods that are common at the front and back , World peace , sing and dance to extol the good times .
How to share front and back content ?
data sharing ： For the same virtual front and back dom, Server use renderToNodeStream
, Return the result as a stream , So you don't have to wait html Render all to show the results to the client ,. meanwhile , On the browser side , use hydrate Make virtual dom Render as real DOM
element . If the browser side compares with the number of components rendered by the server side , In case of inconsistency , Don't throw away everything , It's a partial rendering . So in the rendering process using the server , To ensure the consistency of front-end and rear component data . Here, the data requested by the server will be , Insert into
js In the global variable of , along with html Render to browser side together （ dehydration ）; This is on the browser side , You can get the dehydration data to initialize the components , Add interaction, etc （ water flooding ）.