mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
chrone: sperate client and server to different repos.
This commit is contained in:
13
src/hooks/useAutofocus.js
Normal file
13
src/hooks/useAutofocus.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user