import React, { useState } from "react"; import { RadioType, AnswersType, AnswerProps } from "../types"; interface Props extends AnswerProps { element: RadioType; } export const ARadioForm = ({ element, answers, handleAnswer }: Props) => { const [answer, setAnswer] = useState(""); const handleChange = (event: React.ChangeEvent) => { const { value } = event.currentTarget; answers && (answers.answer = value); setAnswer(value); handleAnswer(); }; return (
{element.content.choices.map((choice) => (
))}
); };