import React, { useState } from "react"; import { IRating, IAnswerProps } from "../types"; export const ARating = ({ element, answer: answerQuestion }: IAnswerProps) => { const [selectedchoice, setSelectedchoice] = useState(""); const [answer, setAnswer] = useState(""); function buttonClick(event: React.MouseEvent) { event.preventDefault(); const { name } = event.currentTarget; answerQuestion.content = name; setAnswer(name); setSelectedchoice(event.currentTarget.name); if (answerQuestion.content) { answerQuestion.requiredCheck = true; } else { answerQuestion.requiredCheck = false; } console.log(answerQuestion); } return (
{element.content.choices.map((choice) => (
))}
); };