I am trying to add a username in my anchor tag's href
property. My Code is,
var Name = React.createClass({
render: function() {
return (
<div>
<a href="www.example.com/"+ { this.props.username} +"" className="post-title">{this.props.name}</a><br />
</div>
);
}
});
But, I am getting an error saying undefined token +
near that href property. I think this is due to I am trying to add it in render method. So, is there any other approach?
Thank you..
Remove the +
. It should be:
<a href={"www.example.com/" + this.props.username} ...
另一种方法是:
<a href={`https://www.example.com/${this.props.username1}`}>link</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.