How to return each item of array separately js

581 views Asked by At

I have an array of Viro items that when displayed the onClick function does not work, I think because they are in an array when inputed into ViroARScene. Is there anyway to return all elements of the array separately in their form?

Edit, sample code:

<ViroARScene>
 {ARObjects}
<ViroARScene/> 

where {ARObjects} is an array of Viro items such as and so on

ARObjects = [<ViroImage/>,<ViroPolygon/>,etc]
1

There are 1 answers

0
George D'Paula On

Use the forEach function, try this:

<ViroARScene>
 {ARObjects.forEach(element => return(element))}
</ViroARScene>