A
A
Andrew2019-02-08 16:43:09
JavaScript
Andrew, 2019-02-08 16:43:09

How to get data before rendering the page?

Actually the question is: how to get data on the server side, fill the page with this data and only after that return it to the client (browser)?
I don't need isomorphism. It is necessary that the server go for data to other server APIs and fill the page with them.
I looked at a lot of boilerplates, I didn’t see such functionality in any of them. I admit that I missed something or simply did not understand.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Okhotnikov, 2019-02-08
@tsepen

This is not done, the component is first rendered, then the data is requested. If there is no data, you can display the preloader before they are loaded. Example at the link
This is necessary for the user to see the page immediately, there may also be problems if the server returns an error - the user will not see anything at all.

E
Egor Zhivagin, 2019-02-08
@Krasnodar_etc

Seems like you need an SSR

B
bpGusar, 2019-02-08
@bpGusar

smacks of next.js

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question