Browse Source

Document multiple ways to insert comments in JSX

main
Christopher Chedeau 11 years ago
parent
commit
4ed066b0ce
  1. 14
      docs/02.1-jsx-in-depth.md

14
docs/02.1-jsx-in-depth.md

@ -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>
);
```

Loading…
Cancel
Save