ref (refence)

ref (refence)

3초 후에 input 태그에 focus가 되게 ref 속성을 주었다.

import React, { useRef } from "react"; const App = () => { const test = useRef(); // test에는 ref를 설정해준 input 태그가 담깁니다. setTimeout(() => test.current.focus(), 3000); return ( <> Hello ); }; export default App;

from http://darrengwon.tistory.com/178 by ccl(A) rewrite - 2020-03-22 19:20:16

댓글

이 블로그의 인기 게시물

단위 테스트 환경 구축

Coupang CS Systems 채용 정보: Front-end 개발자를 찾습니다!

스토리북에서 스토리를 작성하는 방법