You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
348 B

class MyComponent extends React.Component {
constructor(props) {
super(props);
// highlight-next-line
this.inputRef = React.createRef();
}
render() {
// highlight-next-line
return <input type="text" ref={this.inputRef} />;
}
componentDidMount() {
// highlight-next-line
this.inputRef.current.focus();
}
}