I have two arrays. The i'th element from both arrays form one component. I want to render multiple components like this in a list. Here's the code
var ShowData = React.createClass({
render:function(){
var itemNames = this.props.names.map(function(item){
return <div>{item}</div>;
});
var itemDesc = this.props.contents.map(function(description){
return <p>{description}</p>;
});
return(
<div>
<h3> {itemNames}</h3>
<div>{itemDesc}</div>
</div>
)
}
});
Here's my render function
<ShowData names = {this.state.items} contents = {this.state.desc} />
It displays the entire first array and then the entire second array. What gives?