import React, { useState } from "react"; import { RadioType, AnswersType, AnswerProps } from "../types"; interface Props extends AnswerProps { element: RadioType; answerQuestion: any | undefined; } export const ARadioForm = ({ element, answerQuestion }: Props) => { const [answer, setAnswer] = useState(""); const handleChange = (event: React.ChangeEvent) => { const { value } = event.currentTarget; answerQuestion.answer = value; setAnswer(value); if (answerQuestion.answer) { answerQuestion.requiredCheck = true; } else { answerQuestion.requiredCheck = false; } console.log(answerQuestion); }; return (
{element.content.choices.map((choice) => (
))}
); };