The first method is to place a loading prompt in the rendered area in advance, hide/delete the loading after rendering, and display normal content.
The second method is to give the data an initial value, which can support the page style, and then replace it after obtaining it.
The transformation of the second method starts from CSS, so that the unrendered part can be displayed and the structure is consistent with that after rendering. After rendering is completed, only the corresponding data is changed, and the page structure is not changed.
In addition to the solution in the first answer, you can also consider isomorphism. Reactjs provides such a solution. The output of nodejs is the formed page. There is no need for the client to rerender once, and there is no problem of flashing.
The first method is to place a loading prompt in the rendered area in advance, hide/delete the loading after rendering, and display normal content.
The second method is to give the data an initial value, which can support the page style, and then replace it after obtaining it.
The transformation of the second method starts from CSS, so that the unrendered part can be displayed and the structure is consistent with that after rendering. After rendering is completed, only the corresponding data is changed, and the page structure is not changed.
Using
ng-cloak
和v-cloak
, I have never been exposed to React so I don’t know.In addition to the solution in the first answer, you can also consider isomorphism. Reactjs provides such a solution. The output of nodejs is the formed page. There is no need for the client to rerender once, and there is no problem of flashing.