mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
15 lines
259 B
TypeScript
15 lines
259 B
TypeScript
// @ts-nocheck
|
|
import { useRef, useEffect } from 'react';
|
|
|
|
export default function useAutofocus(focus = true) {
|
|
const ref = useRef();
|
|
|
|
useEffect(() => {
|
|
if (ref.current && focus) {
|
|
ref.current.focus();
|
|
}
|
|
}, [ref, focus]);
|
|
|
|
return ref;
|
|
}
|