function ComplexForm() { const [formData, setFormData] = useState({ name: "", email: "", description: "", }); const handleChange = (e) => { const { name, value } = e.target; setFormData((prevData) => ({ ...prevData, [name]: value })); }; const handleSubmit = (e) => { e.preventDefault(); alert(JSON.stringify(formData, null, 2)); }; return ( <form onSubmit={handleSubmit}> <div> <label>Name:</label> <input type="text" name="name" value={formData.name} onChange={handleChange} /> </div> <div> <label>Email:</label> <input type="email" name="email" value={formData.email} onChange={handleChange} /> </div> <div> <label>Description:</label> <textarea name="description" value={formData.description} onChange={handleChange} /> </div> <button type="submit">Submit</button> </form> ); }