I have one component which is going to display Array of String. The code looks like this:
React.createClass({
render() {
<div>
this.props.data.map(t => <span>t</span>)
</div>
}
})
It is working perfectly fine.
i.e. if props.data = ['tom', 'jason', 'chris']
, the rendered result in the page would be tomjasonchris
.
Then, I want to join all the names by using comma, so I change the code to:
this.props.data.map(t => <span>t</span>).join(', ')
However, the rendered result is [Object], [Object], [Object]
.
I don't know how to interpret object to become react components to be rendered. Any suggestion?