Wednesday 24 October 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...