简体   繁体   English

组件属性中的es6模板字符串

[英]template string of es6 in attribute of react component

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}` />)
...

您需要将其更改为以下代码。

return (<UserList id={subactions} key={ `applications${query.status}` } />)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM