Browse Source

formatting and syntax on false in JSX tip

main
Paul O’Shannessy 11 years ago
parent
commit
67c99a9c51
  1. 5
      tips/13-false-in-jsx.md

5
tips/13-false-in-jsx.md

@ -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>`.

Loading…
Cancel
Save