【发布时间】:2018-04-15 10:42:32
【问题描述】:
我不知道将 span 中的代码和附加它的文本分开
getAuthorInfo() {
if (this.props.anonymous_author) {
return <p className="meta-data-type topic-label">{this.props.author.display_name}, {this.props.author.primary_specialty_name}</p>;
}
return <p className="meta-data-type topic-label">{this.props.author.display_name}, {this.props.author.primary_specialty_name} <span className="glyphicon glyphicon-map-marker" />{this.props.author.location}</p>;
}
我认为 jsx 不允许我将变量定义为纯文本 有什么想法吗?
【问题讨论】:
-
不太明白你的问题
-
你在使用 React 16 吗?
标签: javascript html reactjs jsx