mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
counterexample -> antipattern
This commit is contained in:
@@ -129,7 +129,7 @@ Since this method describes the view at any point in time, the value of the text
|
||||
In HTML, the value of `<textarea>` is usually set using its children:
|
||||
|
||||
```html
|
||||
<!-- counterexample: DO NOT DO THIS! -->
|
||||
<!-- antipattern: DO NOT DO THIS! -->
|
||||
<textarea name="description">This is the description.</textarea>
|
||||
```
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Notice how, in this example, we want to "tell" the input something - something t
|
||||
This means that you should never "hold onto" something that you return from `render()` and then expect it to be anything meaningful.
|
||||
|
||||
```javascript
|
||||
// counterexample: DO NOT DO THIS!
|
||||
// antipattern: This won't work.
|
||||
render: function() {
|
||||
var myInput = <input />; // I'm going to try to call methods on this
|
||||
this.rememberThisInput = myInput; // input at some point in the future! YAY!
|
||||
@@ -61,7 +61,7 @@ This means that you should never "hold onto" something that you return from `ren
|
||||
}
|
||||
```
|
||||
|
||||
In this counterexample, the `<input />` is merely a *description* of an `<input />`. This description is used to create a *real* **backing instance** for the `<input />`.
|
||||
In this example, the `<input />` is merely a *description* of an `<input />`. This description is used to create a *real* **backing instance** for the `<input />`.
|
||||
|
||||
So how do we talk to the *real* backing instance of the input?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user