import React, { useState } from "react"; import { CheckboxType, AnswersType, AnswerProps } from "../types"; interface Props extends AnswerProps { element: CheckboxType; } export const ACheckboxForm = ({ 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) => (
))}
); };