mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
feat: auto-focus first fields.
This commit is contained in:
13
client/src/hooks/useAutofocus.js
Normal file
13
client/src/hooks/useAutofocus.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useRef, useEffect } from 'react';
|
||||
|
||||
export default function useAutofocus() {
|
||||
const ref = useRef();
|
||||
|
||||
useEffect(() => {
|
||||
if (ref.current) {
|
||||
ref.current.focus();
|
||||
}
|
||||
}, [ref]);
|
||||
|
||||
return ref;
|
||||
}
|
||||
Reference in New Issue
Block a user