Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add comma in react map

var List = React.createClass({
  render: function() {
    return (
      <div>
        {
          this.props.data.map(function(item, index) {
            return <span key={`demo_snap_${index}`}>{ (index ? ', ' : '') + item }</span>;
          })
        }
      </div>
    );
  }
});

var data = ["red", "green", "blue"];

ReactDOM.render(<List data={data} />, demo);
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to run electron and react using concurrently 
Javascript :: js input trigger oninput event 
Javascript :: Quoting Strings with Single Quote 
Javascript :: mongoose express js require 
Javascript :: navigation react pass props 
Javascript :: round to nearest decimal javascript 
Javascript :: Check for a Null or Empty String in JavaScript 
Javascript :: loop through array react native 
Javascript :: change img src css 
Javascript :: react native toast message 
Javascript :: draw border on canvas 
Javascript :: convert jquery to string 
Javascript :: popup in browser js 
Javascript :: typescript react handle change 
Javascript :: using ejs with express 
Javascript :: dropdown search field in react native 
Javascript :: react hooks component re render when button press 
Javascript :: update to node 12 mac 
Javascript :: ajax actions wordpress 
Javascript :: int to string javascript 
Javascript :: export multiple functions react 
Javascript :: reset form jquery 
Javascript :: promise.all 
Javascript :: javascript copy array 
Javascript :: javascript function page size 
Javascript :: javascript lowest number 
Javascript :: javascript push array with key name 
Javascript :: scroll load react 
Javascript :: usecallback 
Javascript :: store with redux-thunk 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =