Not sure how to loop through an array
Answered
Minskin posted this in #help-forum
MinskinOP
Hi everyone! I have an interface that holds onto an array of information. I would like to loop through each of of them and call a function for each tab. I wasn't able to make anything online work though :/
10 Replies
MinskinOP
@Minskin Click to see attachment
the syntax of forEach is wrong
props.tabs.forEach(tab=>ContentTab(...))
forEach returns
undefined
you need to use .map instead to render list items
Answer
MinskinOP
Do you perhaps have a link on the topic?
MinskinOP
Thanks :)
@Yi Lon Ma Awesome, it works now! Thank you for the help, I really appreciate it :)