1import React, { useEffect, useRef } from 'react';
2
3const fooComponent = props => {
4 const inputBtnRef = useRef(null);
5 useEffect(() => {
6 //Add the ref action here
7 inputBtnRef.current.focus();
8 });
9
10 return (
11 <div>
12 <input
13 type="text"
14 ref={inputBtnRef}
15 />
16 </div>
17 );
18}