import React, { useState } from "react"; import { CheckboxType } from "../types"; type Props = { element: CheckboxType; handleQuestion: (id: string) => void; }; export const CheckboxForm = ({ element, handleQuestion }: Props) => { const [choices, setChoices] = useState([...element.content.choices]); function handleContent(event: React.ChangeEvent) { const { id, value } = event.target; choices[+id].text = value; element.content.choices = choices; handleQuestion(element._id); console.log(choices); } return (
{choices.map((choice: any, index: number) => (
))}
); };