[英]How to comment in react that will be compiled by webpack
It's all in the title really, I've try'ed: 我试过了,实际上是标题中的所有内容:
/*Comment here*/
and 和
//Comment here
But both show up on the webpage. 但是两者都显示在网页上。
The only way to add comments in JSX is to use {/* ... */}
syntax, for example: 在JSX中添加注释的唯一方法是使用{/* ... */}
语法,例如:
...
<div>
{/* A JSX comment */}
</div>
...
The HTML comments <!-- ... -->
do not work, plain JS comments //
and /* ... */
do not work too. HTML注释<!-- ... -->
不起作用,普通的JS注释//
和/* ... */
也不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.