A
A
ayapergenov2019-05-02 09:59:36
React
ayapergenov, 2019-05-02 09:59:36

How to make links in a loop?

You need to make references in the React component's loop. Prompt the correct syntax, please.

<CardImg top width="100%" src={`/${item.picture}`} alt="{item.imgalt}" />

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2019-05-02
@ayapergenov

{items.map(item => (
  <CardImg key={item.picture} top width="100%" src={item.picture} alt={item.imgalt} />
))}

Lists and keys

X
xxx44552, 2019-05-13
@xxx44552

<CardImg top width="100%" src={require(`${item.picture}`)} alt="{item.imgalt}" />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question