Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react for loop in render

render: function() {
  const elements = ['one', 'two', 'three'];
  return (
    <ul>
      {elements.map((value, index) => {
        return <li key={index}>{value}</li>
      })}
    </ul>
  )
}
Source by flaviocopes.com #
 
PREVIOUS NEXT
Tagged: #react #loop #render
ADD COMMENT
Topic
Name
1+6 =