"use client"; import { useEffect, useRef } from "react"; import type { FormEvent } from "react"; interface AnswerFormProps { answerA: string; answerB: string; disabled: boolean; error: string; onAnswerAChange: (value: string) => void; onAnswerBChange: (value: string) => void; onSubmit: (event: FormEvent) => void; } export default function AnswerForm({ answerA, answerB, disabled, error, onAnswerAChange, onAnswerBChange, onSubmit, }: AnswerFormProps) { const firstInputRef = useRef(null); const secondInputRef = useRef(null); const submitButtonRef = useRef(null); useEffect(() => { if (!disabled) { firstInputRef.current?.focus(); } }, [disabled]); return (
{error ? (

{error}

) : null}
); }