콜백 함수를 통한 ref 설정 ref를 달고자 하는 요소에 ref라는 콜백 함수를 props로 전달해준다. 이 콜백 함수는 ref 값을 파라미터로 전달받아 함수 내부에서 ref를 컴포넌트의 멤버 변수로 설정한다. {this.input=ref}} /> this.input은 input요소의 DOM을 가리키게 된다. createRef를 통한 ref 설정 리액트에 내장되어 있는 createRef라는 함수를 사용한다. 리액트 v16.3부터 도입되었다. import React, { Component } from "react"; class RefSample extends Component { input = React.createRef(); handleFocus = () => { this.input.focus(); }..