Update syntax.md

Some inconsistencies pointed out in FB comments
This commit is contained in:
Pete Hunt
2013-07-02 18:27:15 -07:00
parent c3bc59a526
commit dc25c4d32b

View File

@@ -37,7 +37,7 @@ var Nav;
// Input (JSX):
var app = <Nav color="blue" />;
// Output (JS):
var app = Nav({color:'blue'});
var app = Nav({color:'blue'}, null);
```
Notice that in order to use `<Nav />`, the `Nav` variable must be in scope.
@@ -49,7 +49,7 @@ var Nav, Profile;
// Input (JSX):
var app = <Nav color="blue"><Profile>click</Profile></Nav>;
// Output (JS):
var app = Nav({color:'blue'}, Profile({}, 'click'));
var app = Nav({color:'blue'}, Profile(null, 'click'));
```
Use the [JSX Compiler](/react/jsx-compiler.html) to try out JSX and see how it
@@ -114,7 +114,7 @@ var Nav;
// Input (JSX):
var tree = <Nav><span /></Nav>;
// Output (JS):
var tree = Nav({}, React.DOM.span({}));
var tree = Nav(null, React.DOM.span(null, null));
```
> Remember:
@@ -145,7 +145,7 @@ Likewise, JavaScript expressions may be used to express children:
// Input (JSX):
var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;
// Output (JS):
var content = Container({}, window.isLoggedIn ? <Nav /> : <Login />);
var content = Container(null, window.isLoggedIn ? Nav(null, null) : Login(null, null));
```
## Tooling