Reputation: 393
Hi I have a response coming from an API as a JSON ["a","b","c"]. I want to display this json Element Wise in a React Component. I have converted the JSON into array. I am able to display the whole JSON and array as a whole on the component but not able to display it element wise.
In javascript i used to put a for loop and display all element by document.write but I want to know how to do so in REACT JS.
Upvotes: 3
Views: 6231
Reputation: 757
In the render() function:
<ul>
{yourArray.map((item,index) =>
<li key={index}>{item}</li>
)}
</ul>
Is this what you want to do?
Upvotes: 5