A
A
ASiD2020-06-03 08:26:12
React
ASiD, 2020-06-03 08:26:12

How to load data from API before page rendering with SSR in REACT?

Good afternoon. There is an app in React. It has a page. The data to display is stored in the hook (useState) and loaded via the API (fetch). Accordingly, while there is no data, I show the inscription "Loading", when they appear, I draw the page as it should be.

The problem is that SSR renders a page that says "Loading". Tell me how to make React wait for data from the API with SSR and only then give the page?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question