// EmailInput wraps an HTML `input` and adds some app-specific styling. const EmailInput = React.forwardRef((props, ref) => ( )); class App extends Component { emailRef = React.createRef(); render() { return (
); } // `this.emailRef.current` points to the `input` component inside of EmailInput, // because EmailInput is forwarding its ref via its `React.forwardRef` callback. onClickButton() { this.emailRef.current.focus(); } }