import React, { useState } from "react"; import { IRadio, IAnswerProps } from "../types"; export const ARadio = ({ element, answer: answerQuestion }: IAnswerProps) => { const [answer, setAnswer] = useState(""); const handleChange = (event: React.ChangeEvent) => { const { value } = event.currentTarget; answerQuestion.content = value; setAnswer(value); if (answerQuestion.content) { answerQuestion.requiredCheck = true; } else { answerQuestion.requiredCheck = false; } console.log(answerQuestion); }; return (
{element.content.choices.map((choice) => (
))}
); };