Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import { useEffect, useRef } from 'react';
import MyTextBox from './MyTextBox';
export default function HookRefForward() {
const text = useRef(null);
// 시작 시 텍스트 상자에 포커스 맞추기
useEffect(() => {
text.current?.focus();
}, []);
return (
<MyTextBox label="name" ref={text} />
);
} |