From c44f4e577ddbda3d9b786a6223b535e0b68805f6 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 9 Mar 2020 19:42:08 +0100 Subject: [PATCH] Use const for ref in functional component docs (#1129) Co-authored-by: Sunil Pai --- content/docs/refs-and-the-dom.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/refs-and-the-dom.md b/content/docs/refs-and-the-dom.md index 9653b64a..fd8f5832 100644 --- a/content/docs/refs-and-the-dom.md +++ b/content/docs/refs-and-the-dom.md @@ -168,8 +168,8 @@ 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 = useRef(null); - + const textInput = useRef(null); + function handleClick() { textInput.current.focus(); }