Document multiple ways to insert comments in JSX

This commit is contained in:
Christopher Chedeau
2014-05-08 11:47:24 -07:00
committed by Paul O’Shannessy
parent 0247d9d625
commit 6d2dd794ee
+12 -2
View File
@@ -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>
);
```