export const InputComponent = () => { const inputRef = useRef<HTMLInputElement | undefined>(); useEffect(() => { inputRef.current.focus(); }, [inputRef]); return(<input type="text" ref={inputRef}) }¿Qué hay de malo en mi código? Por favor, ayúdame.
export const InputComponent = () => { const inputRef = useRef<HTMLInputElement | undefined>(null); useEffect(() => { inputRef.current.focus(); }, [inputRef]); return(<input type="text" ref={inputRef}) }Intenta usar este código. verifique este codesandbox
Te perdiste el paréntesis de cierre de la etiqueta de input .
return <input type="text" ref={inputRef} />