Custom component API calls


I have a situation I am struggling with. I have a string of text come into my component as an input. I need to send each item to an api to get a response back, then combine them to update the component.

The issue I am having is due to the async nature of getting these API reqests. My code looks something like this:

function ComponentLogic(props){

	var {propA,propB} = props;
	var splitPropA = somefunction(propA);//A list 
	var responseData = "";
	var combinedOutput = "";
	for (var i = 0; i < summaries.length; i++){
		responseData = getRequestResponse(splitPropA[i]); //Returns a promise!
		combinedOutput += responseData;

	return <></>


Tried all sorts of ways to do this but cannot find one that works. How would you all do this?

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.