Use const for ref in functional component docs (#1129)

Co-authored-by: Sunil Pai <threepointone@fb.com>
This commit is contained in:
Andy
2020-03-09 19:42:08 +01:00
committed by GitHub
parent 420fc316c5
commit c44f4e577d

View File

@@ -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();
}