I started a project last week. Before getting back with my team, I would like to comment my code.
我上周开始了一个项目。在回到我的团队之前,我想评论我的代码。
/* Just for the Syntax outlook */
class Foo extends React.Components {
constructor(props) {
super(props);
}
render() {
return (
<div className='bar'>
/*
<p> cannot commit!!!! </p>
** Following will throw error when bundled with webpack
*/
// This throws error as well.
<div>
)
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
The code may seem like commenting is working, but current JSbin's setting is not set on ES6. When you run bundle it via webpack with jsx it throws an error.
代码可能看似评论正在工作,但当前的JSbin设置未在ES6上设置。当您通过webpack使用jsx运行捆绑它时会抛出错误。
Here are the following stacks
以下是以下堆栈
反应ES6 JSX Babel
Btw, because Node v6 is out, do we still need to use babel?
顺便说一句,因为Node v6已经出局了,我们还需要使用babel吗?
12
You can comment in jsx but you need to wrap it in curly braces -
你可以在jsx中发表评论,但你需要用花括号包裹它 -
{/* A JSX comment */}
{/*
Multi
line
comment
*/}
See the React docs
请参阅React文档
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2016/05/01/9b1417b4e680fc20ad61c309d1caf21c.html。