1
1
12332112020-09-02 18:32:09
React
1233211, 2020-09-02 18:32:09

How to understand that all requests have been processed on a specific page?

I want to display the text "loading" on all pages instead of the main content, while requests are in progress on a specific page. As soon as all requests have been processed and given at least some answer, display the main content. How to do it right? Not wrapping all requests in promise.all etc. Interested in a universal solution so that it is not necessary to climb into the code of each component.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Karpion, 2020-09-02
@Karpion

Well, you need to look at what kind of requests, who makes these requests, what is the criterion for executing each request.
It seems that the easiest way is to make two blocks. The first says "Loading", the second - the main content. Initially - the first block is visible, the second is hidden. As soon as the state "all requests are completed" is reached - hide the first block, open the second.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question