Browse Source

Update 09.2-form-input-binding-sugar.md

Add better explanation for 2-way data binding to checkboxes using `checkedLink`. As mentionned here: https://github.com/facebook/react/issues/1930
main
Sébastien Lorber 11 years ago
parent
commit
0497845ad5
  1. 6
      docs/09.2-form-input-binding-sugar.md

6
docs/09.2-form-input-binding-sugar.md

@ -66,7 +66,11 @@ var WithLink = React.createClass({
`ReactLink` objects can be passed up and down the tree as props, so it's easy (and explicit) to set up two-way binding between a component deep in the hierarchy and state that lives higher in the hierarchy.
Note that `<input>` supports ReactLink for both `value` and `checked`.
Note that `<input>` supports ReactLink for both `value` and `checked`. For checkboxes, you should use `checkedLink` instead of `valueLink`, as their value is fixed to `on`:
```
<input type="checkbox" checkedLink=valueLink={this.linkState('booleanValue')} />
```
## Under the Hood

Loading…
Cancel
Save