The front and back ends of the web are separated. How can the first screen data be loaded quickly?


1. The front and back ends are separated. How to render the data on the first screen of the page requires the data and dom to be rendered at the same time (ajax will cause DOM nodes to render first, and the data will render slower). At present, it is not clear how to do this. If PHP code is nested, is it against the idea of separating the front and back ends?

Note: Home page data are mainly news data.

Using PHP code nesting does not violate the separation of front and back ends. Because the front and rear ends are generally separated by an intermediate layer, it can be usednodeOr ..PhpWait. The middle tier can do many operations, such as: interface proxy, route control, server rendering … in fact, your problem belongs to server rendering, and you have no problem using php.
In addition, in fact, your news related pages should use similar component handlingreact-placeholder