showing results for - "how to add comma in react map"
Sara
26 Mar 2016
1var List = React.createClass({
2  render: function() {
3    return (
4      <div>
5        {
6          this.props.data.map(function(item, index) {
7            return <span key={`demo_snap_${index}`}>{ (index ? ', ' : '') + item }</span>;
8          })
9        }
10      </div>
11    );
12  }
13});
14
15var data = ["red", "green", "blue"];
16
17ReactDOM.render(<List data={data} />, demo);