const FocusDemo = () => { const [inputRef, setInputFocus] = useFocus() return ( <>
Focus
)}const useFocus = () => { const htmlElRef = useRef(null) const setFocus = () => {htmlElRef.current && htmlElRef.current.focus()} return [ htmlElRef, setFocus ] }