We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5bf594 commit 2f97f48Copy full SHA for 2f97f48
content/docs/refs-and-the-dom.md
@@ -279,18 +279,18 @@ class CustomTextInput extends React.Component {
279
this.textInput = null;
280
281
this.setTextInputRef = element => {
282
- this.textInput = element
+ this.textInput = element;
283
};
284
285
this.focusTextInput = () => {
286
// Focus the text input using the raw DOM API
287
- this.textInput.focus();
+ if (this.textInput) this.textInput.focus();
288
289
}
290
291
- componentDidMount () {
+ componentDidMount() {
292
// autofocus the input on mount
293
- if (this.textInput.current) this.focusTextInput()
+ this.focusTextInput();
294
295
296
render() {
0 commit comments