我想收到来自道具的图像。在道具中,它包含URL的路径。从反应道具中呈现图像,
由于某种原因,这是行不通的。
render(){
const imageURL = require(`${this.props.photo}`)
return (
<div className="profile">
<img alt="mug shot" src={imageURL} />
但工程....
render(){
return (
<div className="profile">
<img alt="mug shot" src={require('../../Assets/Photos/Four.png')} />
该应用程序是使用创建反应的应用程序内进行配置。
如果你直接在src中使用道具吗?像' – pritesh
这不会渲染,它需要,要求声明 –