GregBrimble/cf-workers-dashboard

View on GitHub
packages/client/src/hooks/useFocus.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import { useRef, MutableRefObject } from "react";

export const useFocus = (): [MutableRefObject<any>, () => {}] => {
  const ref = useRef<any>(null);
  const setFocus = () => ref.current?.focus();
  return [ref, setFocus];
};