Alex Krolick
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
3 deletions
-
content/docs/refs-and-the-dom.md
|
@ -276,15 +276,15 @@ class CustomTextInput extends React.Component { |
|
|
constructor(props) { |
|
|
constructor(props) { |
|
|
super(props); |
|
|
super(props); |
|
|
|
|
|
|
|
|
this.textInput = { current: null }; // initial placeholder for the ref |
|
|
this.textInput = null; |
|
|
|
|
|
|
|
|
this.setTextInputRef = element => { |
|
|
this.setTextInputRef = element => { |
|
|
this.textInput.current = element |
|
|
this.textInput = element |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
this.focusTextInput = () => { |
|
|
this.focusTextInput = () => { |
|
|
// Focus the text input using the raw DOM API |
|
|
// Focus the text input using the raw DOM API |
|
|
this.textInput.current.focus(); |
|
|
this.textInput.focus(); |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|