Q
Q
qwerty17772018-03-14 10:30:24
css
qwerty1777, 2018-03-14 10:30:24

How to write the src path in React correctly?

How to correctly write the path to src in React?

<img className="img-fluid" src={'{i/com/'+v.picture+'}'} alt=""/>

where v.picture is the picture data

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2018-03-14
@qwerty1777

img className="img-fluid" src={'i/com/'+v.picture} alt=""/>

ps you just need to pass a string to the src attribute, like i/com/temp.jpg, and you get:{i/com/temp.jpg}

A
Aleksandrov, 2018-03-14
@alexandr2006

It is possible as above, but a more pontoon would use template lines src={`i/com/${v.picture}`}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question