import React, { useState } from "react"; import { EssayType, AnswersType } from "../types"; type Props = { element: EssayType; answers: AnswersType | undefined; handleAnswer: () => void; }; export const AEssayForm = ({ 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 && (answers.answer = value); setAnswer(value); handleAnswer(); }; return (
); };