You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
666 B
30 lines
666 B
11 years ago
|
---
|
||
11 years ago
|
id: false-in-jsx
|
||
11 years ago
|
title: False in JSX
|
||
11 years ago
|
layout: tips
|
||
11 years ago
|
permalink: false-in-jsx.html
|
||
11 years ago
|
prev: initial-ajax.html
|
||
|
---
|
||
|
|
||
11 years ago
|
Here's how `false` renders in different contexts:
|
||
11 years ago
|
|
||
|
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);
|
||
|
```
|
||
|
|
||
11 years ago
|
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>`.
|