Skip to content

Commit

Permalink
Update 17.controlled-uncontrolled-input.md
Browse files Browse the repository at this point in the history
The example is misleading.

Whenever the input has a `value` prop, it will be controlled and you still would not be able to change its value.

Just forked this <https://jsfiddle.net/8nu2e8ut/> as a simple example to test.
  • Loading branch information
v0lkan authored Apr 26, 2017
1 parent 681ffda commit 15e27dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patterns/17.controlled-uncontrolled-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UncontrolledNameInput extends React.Component {
}

render() {
return <input type="text" value={this.state.name} />
return <input type="text" />
}
};
```
Expand Down Expand Up @@ -140,4 +140,4 @@ Likewise, `<input type="checkbox">` and `<input type="radio">` support defaultCh
- Gist: https://gist.github.com/vasanthk/a6bf35857749b09275a339f6fd9469bb
- In depth: https://goshakkk.name/controlled-vs-uncontrolled-inputs-react/
- https://www.sitepoint.com/video-controlled-vs-uncontrolled-components-in-react/
- https://facebook.github.io/react/docs/uncontrolled-components.html
- https://facebook.github.io/react/docs/uncontrolled-components.html

0 comments on commit 15e27dd

Please sign in to comment.