1function NameList() {
2 const names = ['Bruce', 'Clark', 'Diana']
3 return (
4 <div>
5 {names.map(name => <h2>{name}</h2>)}
6 </div>
7 )
8}
1render() {
2 const elements = ['one', 'two', 'three'];
3
4 const items = []
5
6 for (const [index, value] of elements.entries()) {
7 items.push(<li key={index}>{value}</li>)
8 }
9
10 return (
11 <div>
12 {items}
13 </div>
14 )
15}