import React, { useState } from "react"; import { RadioType, AnswerType } from "../types"; type Props = { element: RadioType; response: AnswerType; handleAnswer: () => void; }; export const ARadioForm = ({ element, response, handleAnswer }: Props) => { const [answer, setAnswer] = useState(""); const handleChange = (event: React.ChangeEvent) => { const { value } = event.currentTarget; response.answers.map((a) => { if (a.questionId === element._id) { a.answer = value; } }); setAnswer(value); handleAnswer(); }; return (
{element.content.choices.map((choice) => (
))}
); };