Remove ref usage in main markdown example (#9160)
from [elsewhere in the docs](https://facebook.github.io/react/docs/refs-and-the-dom.html): > Avoid using refs for anything that can be done declaratively.
Adam committed
Mar 12, 2017 at 08:29 UTC
bf5abdf14f55b7f961097b48f78ee4ca7514fed4
1 file changed
+2
-3
docs/_js/examples/markdown.js
+2
-3
@@ -6,8 +6,8 @@ class MarkdownEditor extends React.Component {
6
this.state = {value: 'Type some *markdown* here!'};
7
}
8
9
- handleChange() {
10
- this.setState({value: this.refs.textarea.value});
9
+ handleChange(e) {
10
+ this.setState({value: e.target.value});
11
}
12
13
getRawMarkup() {
@@ -21,7 +21,6 @@ class MarkdownEditor extends React.Component {
21
<h3>Input</h3>
22
<textarea
23
onChange={this.handleChange}
24
- ref="textarea"
24
defaultValue={this.state.value} />
25
<h3>Output</h3>
26
<div