Document multiple ways to insert comments in JSX
Christopher Chedeau committed
Apr 8, 2014 at 15:24 UTC
009be6290660a547f6514cdefe1d5c65d44a6068
1 file changed
+12
-2
docs/docs/02.1-jsx-in-depth.md
+12
-2
@@ -161,10 +161,20 @@ var content = Container(null, window.isLoggedIn ? Nav(null) : Login(null));
161
162
### Comments
163
164
-It's easy to add comments within your JSX; they're just JS expressions:
164
+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.
165
166
```javascript
167
-var content = <Container>{/* this is a comment */}<Nav /></Container>;
167
+var content = (
168
+ <Nav>
169
+ {/* child comment, put {} around */}
170
+ <Person
171
+ /* multi
172
+ line
173
+ comment */
174
+ name={window.isLoggedIn ? window.name : ''} // end of line comment
175
+ />
176
+ </Nav>
177
+);
178
```
179
180