Maitch
Maitch

Reputation: 1

How to return each item of array separately js

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]

Upvotes: -1

Views: 617

Answers (1)

George D&#39;Paula
George D&#39;Paula

Reputation: 1

Use the forEach function, try this:

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

Upvotes: 0

Related Questions