Answers for "how to iterate array in a functional component of react"

6

react js iterate object

<div className="iterate-object">
{
	<ul>
  		{Object.keys(OBJECTHERE).map(function(keyName, keyIndex) {
    		return (
      			<li key={keyName}>
					{keyName}
                    {console.log(OBJECTHERE[keyName])}
          		</li>
    		)
		})}
	</ul>
}
</div>
Posted by: Guest on May-02-2020
0

react loop through array

this.items = this.state.cart.map((item, key) =>    <li key={item.id}>{item.name}</li>);
Posted by: Guest on May-01-2020

Code answers related to "how to iterate array in a functional component of react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language