Skip to content

Commit

Permalink
formatting and syntax on false in JSX tip
Browse files Browse the repository at this point in the history
  • Loading branch information
zpao committed Nov 14, 2013
1 parent 4367dad commit c821887
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/tips/13-false-in-jsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ prev: initial-ajax.html
Here's how `false` renders in different contexts:

Renders as `id="false"`:

```js
/** @jsx React.DOM */
React.renderComponent(<div id={false} />, mountNode);
```

String "false" as input value:

```js
/** @jsx React.DOM */
React.renderComponent(<input value={false} />, mountNode);
```

No child:

```js
/** @jsx React.DOM */
React.renderComponent(<div>{false}</div>, mountNode);
```

The reason why this one doesn't render as the string `"false"` as a `div` child is to allow the more common use-case: `<div>{x > 1 && You have more than one item}</div>`.
The reason why this one doesn't render as the string `"false"` as a `div` child is to allow the more common use-case: `<div>{x > 1 && 'You have more than one item'}</div>`.

0 comments on commit c821887

Please sign in to comment.