When and where to do the HTTP Call?


I have an app thats heavinly based on an API Call thats currently happing on the Client. But its just starting after the DOM is loaded. I did it in componentDidMount() using React. It doesnt take long, but I feel like I Could improve it.


Picture of Network Tab

I can think of 2 possible options here, im not sure are working, and if not how.

  1. Can I let the Client make the API Call instantly after the Connection started, not after DOM

  2. Can I let the server make the API Call and serve it as static content?

The call doesnt have to be real time, but like it should be selfrefreshing. Something like one call every 1h would be enough.

As im a new developer how it normally work if your front page is based on a database, when is the connection made? I guess its similar to how you should structure the API Call.