دنبال کننده ها

۱۳۹۶ آبان ۱۱, پنجشنبه

javascript - a good way to DRY the span element in react code

[ad_1]



I don't know separate the code in span and the text appending it



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>;



I don't think jsx let me to define a variable to be just and raw text
any ideas?




[ad_2]

لینک منبع