
React 字符串(拼)连接+变量
Angularjs字符串拼接变量很简单,因为里面都是js操作,所以不论是
<a ng-href="http://each.sinaapp.com/angular + {{variable}}"> or <a ng-href="{{'http://each.sinaapp.com/angular'+variable}}">
可以的,而在React里面确有点小小的区别,因为里面的Element后面若有变量不允许双引号包围的。
所以
<a href="http://each.sinaapp.com/angular{variable}"> or<a href="http://each.sinaapp.com/angular"+{variable}> // 都不可以 // 只能这样 <a href={'http://each.sinaapp.com/angular' + variable}> or <a href={'http://each.sinaapp.com/angular' + this.props.username}> {this.props.username} </a> or <i className={"header-help-icon down" + isShowLoginMenu ? ' up' : ''}></i>
以上就是react怎么拼接字符串的详细内容,更多请关注易知道|edz.cc其它相关文章!