import type { RefObject } from 'react' ; import { useEffect } from 'react' ; param ref param shouldFocus function useFocus ( ref , shouldFocus = true ) { useEffect ( ( ) => { if ( shouldFocus && ref . current ) { ref . current . focus ( ) ; } } , [ ref , shouldFocus ] ) ; } export default useFocus ;