1class InputExampleRefFocus extends Component {
2 handleRef = (c) => {
3 this.inputRef = c
4 }
5
6 focus = () => {
7 this.inputRef.focus()
8 }
9
10 render() {
11 return (
12 <div>
13 <Button content='focus' onClick={this.focus} />
14 <Input ref={this.handleRef} placeholder='Search...' />
15 </div>
16 )
17 }
18}
19