Files
freeCodeCamp/guide/chinese/certifications/front-end-libraries/react/add-comments-in-jsx/index.md
2018-10-16 21:32:40 +05:30

30 lines
568 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Add Comments in JSX
localeTitle: 在JSX中添加注释
---
## 在JSX中添加注释
您可以像在Javascript `/* some JS code */`那样使用代码块进行注释但它们需要用花括号括起来在JSX中添加注释 例如:
* 单行评论:
```jsx
{/*<h1>Hanoi University of Science</h1>*/}
```
* 多行评论:
```jsx
{/*
<h1>Hanoi University of Science</h1>
<p>Falculty of Mathematics, Mechanics and Informatics</p>
*/}
```
注意您不能在JSX中使用HTML注释如下所示
```html
<!-- not working -->
```