'use client'; import { useState } from "react"; const Form = ({ initialData, onSubmit }) => { const [formData, setFormData] = useState( initialData ); const handleSubmit = (event) => { event.preventDefault(); //q = formData; //addQuestion( q ); //console.log( `Adding question ${JSON.stringify(q)}` ); onSubmit( formData ); } const handleChange = (event) => { const { name, value } = event.target; setFormData( (prevData) => ({ ...prevData, [name]: value })); } return (
{initialData.entries.map( (key, val) => { return( )})}
); } export default Form;