Posted on

Iterate list on react

How to iterate list on React

When you iterate list on React, you can utilize map function. This fucntion will call callback function, with object,iterateCnt parameter.

So if you want to make list items on ul element, You can implement like,

React(ES6)

render() {
 return(
   <ul>
     {this.state.users.map(function(user, i){
       return <li key={i}>{user.name}</li>
     )}
   </ul>
 )
}