From e5bf5945b32218126c4a9ec8986c024ae5b38a07 Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Wed, 14 Mar 2018 17:56:07 -0700 Subject: [PATCH] Unnest callback ref example code https://github.com/facebook/react/pull/12375#issuecomment-373199666 --- content/docs/refs-and-the-dom.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/refs-and-the-dom.md b/content/docs/refs-and-the-dom.md index 02f0ee07..55edec89 100644 --- a/content/docs/refs-and-the-dom.md +++ b/content/docs/refs-and-the-dom.md @@ -276,15 +276,15 @@ class CustomTextInput extends React.Component { constructor(props) { super(props); - this.textInput = { current: null }; // initial placeholder for the ref + this.textInput = null; this.setTextInputRef = element => { - this.textInput.current = element + this.textInput = element }; this.focusTextInput = () => { // Focus the text input using the raw DOM API - this.textInput.current.focus(); + this.textInput.focus(); }; }