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是必需的attribsrc={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,
...