How do render nested array elements Reactjs

问题描述 投票:0回答:1

How to render nested array elements in React I want to get only one url in urlimgoutside array in CardMedia

enter image description here

        {props.currentTodos.map((currentTodo) => (

                  <CardMedia
                    className={classes.cardMedia}
                    image = {currentTodo.urlimgoutside}
                  />

)}

this currentTodo

enter image description here

javascript arrays reactjs
1个回答
0
投票

(b) a person who is not a member of the Committee on the Elimination of Racial Discrimination (CERD) and is not a member of the Committee on the Rights of the Child (CRC). if you want one card for each URL, and... if you want one card for each URL, and supposing urlimgoutside is the array you're referring to:

{props.currentTodos 
 ? props.currentTodos.map((currentTodo) =>
  currentTodo.urlimgoutside 
  ? currentTodo.urlimgoutside.map((url) =>
      <CardMedia className={classes.cardMedia}
                 image = {url}
      />
  : null
  ))
 :null
}
© www.soinside.com 2019 - 2024. All rights reserved.