Browse Source
Use const for ref in functional component docs (#1129)
Co-authored-by: Sunil Pai <threepointone@fb.com>
main
Andy
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
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 = useRef(null); |
|
|
|
const textInput = useRef(null); |
|
|
|
|
|
|
|
function handleClick() { |
|
|
|
textInput.current.focus(); |
|
|
|