classify web
This commit is contained in:
17
components/Common/useAutoFocus.jsx
Normal file
17
components/Common/useAutoFocus.jsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useRef, useEffect } from "react";
|
||||
|
||||
const useAutoFocus = () => {
|
||||
const inputRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
if (inputRef.current) {
|
||||
inputRef.current.focus();
|
||||
}
|
||||
}, 500);
|
||||
}, []);
|
||||
|
||||
return inputRef;
|
||||
};
|
||||
|
||||
export default useAutoFocus;
|
||||
Reference in New Issue
Block a user