Skip to content

Commit 2f97f48

Browse files
committed
Fixed docs
1 parent e5bf594 commit 2f97f48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/docs/refs-and-the-dom.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,18 +279,18 @@ class CustomTextInput extends React.Component {
279279
this.textInput = null;
280280
281281
this.setTextInputRef = element => {
282-
this.textInput = element
282+
this.textInput = element;
283283
};
284284
285285
this.focusTextInput = () => {
286286
// Focus the text input using the raw DOM API
287-
this.textInput.focus();
287+
if (this.textInput) this.textInput.focus();
288288
};
289289
}
290290
291-
componentDidMount () {
291+
componentDidMount() {
292292
// autofocus the input on mount
293-
if (this.textInput.current) this.focusTextInput()
293+
this.focusTextInput();
294294
}
295295
296296
render() {

0 commit comments

Comments
 (0)