组件属性中的es6模板字符串 [英] template string of es6 in attribute of react component
本文介绍了组件属性中的es6模板字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用双引号和单引号连接我的动态变量,但是模板字符串更干净.我得到了一个意外的令牌,为什么有任何线索?
I can use a double and single quote to concatenate my dynamic variable but template string is cleaner. I got an unexpected token, any clue why?
...
return (<UserList id={subactions} key=`applications${query.status}` />)
...
推荐答案
您需要将其更改为以下代码.
You need to change it to the code below.
return (<UserList id={subactions} key={ `applications${query.status}` } />)
这篇关于组件属性中的es6模板字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文