Wednesday, October 24, 2018

android - Use a loop and render multiple jsx items later return to render




I am trying to find a smarter way to loop through an array and generate jsx and return to the render function:




  renderCardImages = () => {
const cards = [
'Visa',
'MasterCard',
'AmericanExpress',
'Discover',
'JCB',
]
return (








)
}


render () {

return (
{renderCardImages()}
)
}


How do I achieve this? I believe render is called only once.


Answer




return (

{card.map(c=>(())}

)

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...