mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Use const for ref in functional component docs (#1129)
Co-authored-by: Sunil Pai <threepointone@fb.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user