I am new to react. I have to link a placeholder in my react-universl static page. What is the syntax to do it? Thanks in advance. I tried 1. image src="http://placehold.it/150x150" 2. image src={" http://placehold.it/150x150 "} 3. image src={require(' http://placehold.it/150x150 ')}
Is there a way to do it? Or do i have to make changes in webpack? Thanks in advance.
The proper answer is <img src="http://placehold.it/150x150" />
, just like in plain HTML.
If you are a beginner, make sure to learn HTML and JavaScript before you start learning React.
无需手动添加src
的唯一方法就是运行客户端JS以遍历所有<img>
并添加src
属性
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.