feat: make journal auto-adjustment for entries.

feat: auto-focus cells inside the table.
This commit is contained in:
a.bouhuolia
2021-01-27 15:02:12 +02:00
parent 81c59f8a1f
commit f8ee455985
9 changed files with 121 additions and 27 deletions

View File

@@ -1,13 +1,13 @@
import { useRef, useEffect } from 'react';
export default function useAutofocus() {
export default function useAutofocus(focus = true) {
const ref = useRef();
useEffect(() => {
if (ref.current) {
if (ref.current && focus) {
ref.current.focus();
}
}, [ref]);
}, [ref, focus]);
return ref;
}