import React, { useState } from "react"; import { DropdownType, AnswersType } from "../types"; type Props = { element: DropdownType; answers: AnswersType; handleAnswer: () => void; }; export const ADropdownForm = ({ element, handleAnswer, answers }: 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; // } // }); answers[element._id] = value; setAnswer(value); handleAnswer(); }; return (
); };