Make the API Call in componentDidMount()
You should populate data with AJAX calls in the componentDidMount
lifecycle method. So you can use setState to update your component when the data is retrieved.
For example using Class:
For example using Hook: