From ba0818beab58e1d60344dcac92324b27c8cb9bef Mon Sep 17 00:00:00 2001 From: Myron Yeung Date: Mon, 9 Mar 2020 07:06:19 -0700 Subject: [PATCH] Fix ref creation in CustomTextInput component (#2072) Change React.createRef() to useRef(null) --- content/docs/refs-and-the-dom.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/refs-and-the-dom.md b/content/docs/refs-and-the-dom.md index e18ab968..9653b64a 100644 --- a/content/docs/refs-and-the-dom.md +++ b/content/docs/refs-and-the-dom.md @@ -168,7 +168,7 @@ You can, however, **use the `ref` attribute inside a function component** as lon ```javascript{2,3,6,13} function CustomTextInput(props) { // textInput must be declared here so the ref can refer to it - let textInput = React.createRef(); + let textInput = useRef(null); function handleClick() { textInput.current.focus();