, /:
1. jsx, :
let arrayOfJsx = [ <div>Hello</div>, <div>World</div> ]
, :
render(){
let arrayOfJsx = [ <div>Hello</div>, <div>World</div> ]
return (
<div> { arrayOfJsx } </div>
)
}
render(){
return (
<div>
<div>Hello</div>
<div>World</div>
</div>
)
}
2 - Array.prototype.forEach Array.prototype.map:
forEach, , , forEach, , , , , forEach. , , , , , Array.prototype.map:
, , .
:
let a = [ 1,2,3 ]
let b = a.map( item => item + 1 )
, , . , , .
. , . :
let a = [ 1,2,3 ]
let arrayOfJsx = a.map( item => <div key={item} > I am { item } </div> )