Skip to content

Commit ba0818b

Browse files
authored
Fix ref creation in CustomTextInput component (#2072)
Change React.createRef() to useRef(null)
1 parent 63a0619 commit ba0818b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/docs/refs-and-the-dom.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ You can, however, **use the `ref` attribute inside a function component** as lon
168168
```javascript{2,3,6,13}
169169
function CustomTextInput(props) {
170170
// textInput must be declared here so the ref can refer to it
171-
let textInput = React.createRef();
171+
let textInput = useRef(null);
172172
173173
function handleClick() {
174174
textInput.current.focus();

0 commit comments

Comments
 (0)