mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Document multiple ways to insert comments in JSX
This commit is contained in:
committed by
Paul O’Shannessy
parent
0247d9d625
commit
6d2dd794ee
@@ -161,10 +161,20 @@ var content = Container(null, window.isLoggedIn ? Nav(null) : Login(null));
|
||||
|
||||
### Comments
|
||||
|
||||
It's easy to add comments within your JSX; they're just JS expressions:
|
||||
It's easy to add comments within your JSX; they're just JS expressions. You just need to be careful to put `{}` around the comments when you are within the children section of a tag.
|
||||
|
||||
```javascript
|
||||
var content = <Container>{/* this is a comment */}<Nav /></Container>;
|
||||
var content = (
|
||||
<Nav>
|
||||
{/* child comment, put {} around */}
|
||||
<Person
|
||||
/* multi
|
||||
line
|
||||
comment */
|
||||
name={window.isLoggedIn ? window.name : ''} // end of line comment
|
||||
/>
|
||||
</Nav>
|
||||
);
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user