Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 为什么React在src上说无效道具?_Reactjs_Image - Fatal编程技术网

Reactjs 为什么React在src上说无效道具?

Reactjs 为什么React在src上说无效道具?,reactjs,image,Reactjs,Image,我不知道为什么?我已经在谷歌上搜索了几次,但什么都没有出现 <img src={this.props.user.picture || this.props.user.gravatar} /> {' '}{this.props.user.name || this.props.user.email || this.props.user.id}{' '} 和猫鼬的用户模型: var userSchema = new mongoose.Schema({ name: String,

我不知道为什么?我已经在谷歌上搜索了几次,但什么都没有出现

<img src={this.props.user.picture || this.props.user.gravatar} />
 {' '}{this.props.user.name || this.props.user.email || this.props.user.id}{' '}
和猫鼬的用户模型:

var userSchema = new mongoose.Schema({
  name: String,
  email: { type: String, unique: true, lowercase: true},      password: String,
  passwordResetToken: String,
  passwordResetExpires: Date,
  gender: String,
  location: String,
  website: String,
  picture: String,
...

picture
gravatar
的值是什么?可能
picture
gravatar
不是字符串?请在问题中包括您的代码和数据结构。Try空字符串可能是初始呈现导致未定义,并且src是必需的attrib
src={this.props.user.picture | | | | | | |‘}
@Chris,我尝试过console.log(gravatar)控制台中没有显示任何内容-我应该把它放在哪里来获取值当我说“gravatar”时,我的意思显然是“this.props.user.gravatar”:)记录它
var userSchema = new mongoose.Schema({
  name: String,
  email: { type: String, unique: true, lowercase: true},      password: String,
  passwordResetToken: String,
  passwordResetExpires: Date,
  gender: String,
  location: String,
  website: String,
  picture: String,
...